Changeset 5685
- Timestamp:
- 07/17/2017 10:24:58 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r5662 r5685 12 12 add_filter( 'pre_option__bbp_edit_lock', array( $this, 'increase_edit_lock_time' ) ); 13 13 add_filter( 'redirect_canonical', array( $this, 'disable_redirect_guess_404_permalink' ) ); 14 add_filter( 'wp_insert_post_data', array( $this, 'set_post_date_gmt_for_pending_posts' ) ); 14 15 add_action( 'wp_print_footer_scripts', array( $this, 'replace_quicktags_blockquote_button' ) ); 15 16 … … 119 120 120 121 return $redirect_url; 122 } 123 124 /** 125 * Keep the original post date when approving a pending post. 126 * 127 * Sets a non-empty 'post_date_gmt' for pending posts to prevent wp_update_post() 128 * from overwriting the post date on approving. 129 * 130 * @param array $data An array of post data. 131 * @return array Filtered post data. 132 */ 133 public function set_post_date_gmt_for_pending_posts( $data ) { 134 if ( 135 in_array( $data['post_type'], array( 'topic', 'reply' ) ) 136 && 137 'pending' === $data['post_status'] 138 && 139 '0000-00-00 00:00:00' === $data['post_date_gmt'] 140 ) { 141 $data['post_date_gmt'] = get_gmt_from_date( $data['post_date'] ); 142 } 143 144 return $data; 121 145 } 122 146
Note: See TracChangeset
for help on using the changeset viewer.