Changeset 5316
- Timestamp:
- 04/11/2017 04:28:33 AM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r5315 r5316 57 57 add_action( 'rest_api_init', array( __NAMESPACE__ . '\API\Base', 'load_routes' ) ); 58 58 59 // Allow post_modified not to be modified when we don't specifically bump it. 60 add_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ), 10, 2 ); 61 59 62 // Work around caching issues 60 63 add_filter( 'pre_option_jetpack_sync_full__started' , array( $this, 'bypass_options_cache' ), 10, 2 ); … … 84 87 register_activation_hook( PLUGIN_FILE, array( $this, 'activate' ) ); 85 88 register_deactivation_hook( PLUGIN_FILE, array( $this, 'deactivate' ) ); 89 } 90 91 /** 92 * Filters `wp_insert_post()` to respect the presented data. 93 * This function overrides `wp_insert_post()`s constant updating of 94 * the post_modified fields. 95 * 96 * @param array $data The data to be inserted into the database. 97 * @param array $postarr The raw data passed to `wp_insert_post()`. 98 * 99 * @return array The data to insert into the database. 100 */ 101 public function filter_wp_insert_post_data( $data, $postarr ) { 102 if ( 'plugin' === $postarr['post_type'] ) { 103 $data['post_modified'] = $postarr['post_modified']; 104 $data['post_modified_gmt'] = $postarr['post_modified_gmt']; 105 } 106 return $data; 86 107 } 87 108 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r5247 r5316 94 94 } 95 95 96 add_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ), 10, 2 );97 96 wp_update_post( $plugin ); 98 remove_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ) );99 97 100 98 // Set categories if there aren't any yet. wp-admin takes precedent. … … 379 377 380 378 /** 381 * Filters `wp_insert_post()` to respect the presented data.382 * This function overrides `wp_insert_post()`s constant updating of383 * the post_modified fields.384 *385 * @param array $data The data to be inserted into the database.386 * @param array $postarr The raw data passed to `wp_insert_post()`.387 *388 * @return array The data to insert into the database.389 */390 public function filter_wp_insert_post_data( $data, $postarr ) {391 if ( 'plugin' === $postarr['post_type'] ) {392 $data['post_modified'] = $postarr['post_modified'];393 $data['post_modified_gmt'] = $postarr['post_modified_gmt'];394 }395 return $data;396 }397 398 /**399 379 * Find the plugin readme file. 400 380 *
Note: See TracChangeset
for help on using the changeset viewer.