Modify WordPress Main Query – The Right Way

[ad_1]

/**
 * Modify WordPress Main Query - The Right Way
 *
 * @refer  https://millionclues.com/wordpress-tips/modify-wordpress-main-query/
 */
function modify_wp_main_query_done_right( $query ) {
  if ( $query->is_main_query() ) {
    $query->query_vars['meta_key'] = 'statusverified_13141'; 
    $query->query_vars['meta_value'] = 1; 
  }
}
add_action( 'pre_get_posts', 'modify_wp_main_query_done_right' );

Refer WP Query to discover other query_vars

[ad_2]

Leave a Reply

Random Post Selection ::

Recent Posts

Unlock Unlimited Downloads