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

Ensure meta queries work for newly-inserted auto draft posts #197

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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