Tag Info

Hot answers tagged

1

The problem is that wp_reset_postdata attempts to restore $post from the main $wp_query, but on post.php in admin, $post isn't populated from $wp_query, so wp_reset_postdata fails to restore it. The solution is to use get_posts and a foreach instead of WP_Query and the loop.


1

You can use $_GET to get the query string values and then pass it in the $args to create a dynamic WP_Query $after = $_GET['after']; $before = $_GET['before']; and then in the $args if ($after && $before) { $args = array( 'date_query' => array( array( 'after' => $after, 'before' ...



Only top voted, non community-wiki answers of a minimum length are eligible