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

Commit c66b957

Browse files
committed
Ensure meta queries work for snapshotted auto draft posts
Props @PatelUtkarsh
1 parent 27c468f commit c66b957

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

php/class-wp-customize-posts.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,10 @@ public function insert_auto_draft_post( $post_type ) {
842842
'post_date_gmt' => $date_gmt,
843843
'post_modified' => $date_local,
844844
'post_modified_gmt' => $date_gmt,
845+
'meta_input' => array(
846+
// Dummy postmeta so that snapshot meta queries won't fail in \WP_Customize_Posts_Preview::get_previewed_posts_for_query().
847+
'_snapshot_auto_draft' => true,
848+
),
845849
);
846850
$r = wp_insert_post( wp_slash( $args ), true );
847851
remove_filter( 'wp_insert_post_empty_content', '__return_false', 100 );

0 commit comments

Comments
 (0)