Make WordPress Core


Ignore:
Timestamp:
11/09/2016 08:42:22 PM (10 years ago)
Author:
westonruter
Message:

Customize: Split out custom_css query logic from wp_get_custom_css() into a re-usable wp_get_custom_css_post() function to also be used when updating.

Props georgestephanis, westonruter.
See #38672, #35395.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-custom-css-setting.php

    r39175 r39185  
    237237
    238238                // Update post if it already exists, otherwise create a new one.
    239                 $post_id = null;
    240                 $query = new WP_Query( array(
    241                         'post_type' => 'custom_css',
    242                         'post_status' => get_post_stati(),
    243                         'name' => sanitize_title( $this->stylesheet ),
    244                         'number' => 1,
    245                         'no_found_rows' => true,
    246                         'cache_results' => true,
    247                         'update_post_meta_cache' => false,
    248                         'update_term_meta_cache' => false,
    249                         'suppress_filters' => true,
    250                 ) );
    251                 if ( ! empty( $query->post ) ) {
    252                         $args['ID'] = $query->post->ID;
     239                $post = wp_get_custom_css_post( $this->stylesheet );
     240                if ( $post ) {
     241                        $args['ID'] = $post->ID;
    253242                        $post_id = wp_update_post( wp_slash( $args ) );
    254243                } else {
Note: See TracChangeset for help on using the changeset viewer.