Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #197 from xwp/bugfix/ensure-meta-queries-join-for-…
Browse files Browse the repository at this point in the history
…auto-draft-posts

Ensure meta queries work for newly-inserted auto draft posts
  • Loading branch information
westonruter authored Jul 14, 2016
2 parents 27c468f + c66b957 commit b65a0ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions php/class-wp-customize-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,10 @@ public function insert_auto_draft_post( $post_type ) {
'post_date_gmt' => $date_gmt,
'post_modified' => $date_local,
'post_modified_gmt' => $date_gmt,
'meta_input' => array(
// Dummy postmeta so that snapshot meta queries won't fail in \WP_Customize_Posts_Preview::get_previewed_posts_for_query().
'_snapshot_auto_draft' => true,
),
);
$r = wp_insert_post( wp_slash( $args ), true );
remove_filter( 'wp_insert_post_empty_content', '__return_false', 100 );
Expand Down

0 comments on commit b65a0ef

Please sign in to comment.