WordPress.org

Making WordPress.org

Changeset 4389


Ignore:
Timestamp:
11/21/2016 05:16:50 AM (3 years ago)
Author:
dd32
Message:

Plugin Directory: Don't allow wp_insert_post() to update the last_updated field (post_modified) on every import action (trunk, manual imports, etc).

Fixes #2258

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php

    r4346 r4389  
    122122        // Bump last updated if the version has changed.
    123123        if ( !isset( $headers->Version ) || $headers->Version != get_post_meta( $plugin->ID, 'version', true ) ) {
    124             $plugin->override_modified_date = true;
    125124            $plugin->post_modified = $plugin->post_modified_gmt = current_time( 'mysql' );
    126125        }
     
    402401
    403402    /**
    404      * Filters `wp_insert_post()` to allow a custom modified date to be specified.
     403     * Filters `wp_insert_post()` to respect the presented data.
     404     * This function overrides `wp_insert_post()`s constant updating of
     405     * the post_modified fields.
    405406     *
    406407     * @param array $data    The data to be inserted into the database.
     
    410411     */
    411412    public function filter_wp_insert_post_data( $data, $postarr ) {
    412         if ( !empty( $postarr['override_modified_date'] ) ) {
     413        if ( 'plugin' === $postarr['post_type'] ) {
    413414            $data['post_modified']     = $postarr['post_modified'];
    414415            $data['post_modified_gmt'] = $postarr['post_modified_gmt'];
Note: See TracChangeset for help on using the changeset viewer.