AnsPress_PostTypes::post_updated_messages( array[] $messages )
Description #
Filter the post updated messages to add Question and Answer custom post type post updated messages.
Parameters #
- $messagesarray[] (Required) Post updated messages.
Source #
File: includes/post-types.php
public static function post_updated_messages( $messages ) { global $post; $permalink = get_permalink( $post->ID ); $scheduled_date = sprintf( /* translators: Publish box date string. 1: Date, 2: Time. */ __( '%1$s at %2$s', 'anspress-question-answer' ), /* translators: Publish box date format, see https://www.php.net/manual/datetime.format.php */ date_i18n( _x( 'M j, Y', 'publish box date format', 'anspress-question-answer' ), strtotime( $post->post_date ) ), /* translators: Publish box time format, see https://www.php.net/manual/datetime.format.php */ date_i18n( _x( 'H:i', 'publish box time format', 'anspress-question-answer' ), strtotime( $post->post_date ) ) ); // Post updated message for Question post type. $messages['question'] = array( 0 => '', // Unused. Messages start at index 1. /* translators: %s Question view URL. */ 1 => sprintf( __( 'Question updated. <a href="%s">View Question</a>', 'anspress-question-answer' ), esc_url( $permalink ) ), 2 => __( 'Custom field updated.', 'anspress-question-answer' ), 3 => __( 'Custom field deleted.', 'anspress-question-answer' ), 4 => __( 'Question updated.', 'anspress-question-answer' ), /* translators: %s: Date and time of the revision. */ 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Question restored to revision from %s.', 'anspress-question-answer' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, // phpcs:ignore WordPress.Security.NonceVerification.Recommended /* translators: %s: Question url */ 6 => sprintf( __( 'Question published. <a href="%s">View Question</a>', 'anspress-question-answer' ), esc_url( $permalink ) ), 7 => __( 'Question saved.', 'anspress-question-answer' ), /* translators: %s: Question url */ 8 => sprintf( __( 'Question submitted. <a target="_blank" href="%s">Preview question</a>', 'anspress-question-answer' ), esc_url( get_preview_post_link( $post ) ) ), 9 => sprintf( /* translators: 1: Scheduled date for the question 2: Question url */ __( 'Question scheduled for: %1$s. <a target="_blank" href="%2$s">Preview question</a>', 'anspress-question-answer' ), '<strong>' . $scheduled_date . '</strong>', esc_url( $permalink ) ), /* translators: %s: Question url */ 10 => sprintf( __( 'Question draft updated. <a target="_blank" href="%s">Preview question</a>', 'anspress-question-answer' ), esc_url( get_preview_post_link( $post ) ) ), ); // Post updated message for Answer post type. $messages['answer'] = array( 0 => '', // Unused. Messages start at index 1. /* translators: %s Answer view URL. */ 1 => sprintf( __( 'Answer updated. <a href="%s">View Answer</a>', 'anspress-question-answer' ), esc_url( $permalink ) ), 2 => __( 'Custom field updated.', 'anspress-question-answer' ), 3 => __( 'Custom field deleted.', 'anspress-question-answer' ), 4 => __( 'Answer updated.', 'anspress-question-answer' ), /* translators: %s: Date and time of the revision. */ 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Answer restored to revision from %s.', 'anspress-question-answer' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, // phpcs:ignore WordPress.Security.NonceVerification.Recommended /* translators: %s: Answer url */ 6 => sprintf( __( 'Answer published. <a href="%s">View Answer</a>', 'anspress-question-answer' ), esc_url( $permalink ) ), 7 => __( 'Answer saved.', 'anspress-question-answer' ), /* translators: %s: Answer url */ 8 => sprintf( __( 'Answer submitted. <a target="_blank" href="%s">Preview answer</a>', 'anspress-question-answer' ), esc_url( get_preview_post_link( $post ) ) ), 9 => sprintf( /* translators: 1: Scheduled date for the answer 2: Answer url */ __( 'Answer scheduled for: %1$s. <a target="_blank" href="%2$s">Preview answer</a>', 'anspress-question-answer' ), '<strong>' . $scheduled_date . '</strong>', esc_url( $permalink ) ), /* translators: %s: Answer url */ 10 => sprintf( __( 'Answer draft updated. <a target="_blank" href="%s">Preview answer</a>', 'anspress-question-answer' ), esc_url( get_preview_post_link( $post ) ) ), ); return $messages; }
Expand full source code Collapse full source code View on GitHub: includes/post-types.php:322
Add your comment