CPT year wise archive based on custom date Field
CPT year wise archive based on custom date Field
CPT year wise archive based on custom date Field
A taxonomy term page isn’t a post type archive. Use is_tax() instead. Also, is_main_query() could be failing because it is not the main query. I know, obvious right. Without the rest of your php code, it is hard to tell. But the “main” query would be the query getting all the posts with that category. … Read more
Pre_get_post custom taxonomy combined with custom fields?
Found it thanks for the investigation tips guys! So when it was doing the meta_value search the search term was showing up the meta_key _wp_old_slug‘s meta_value
A simpler approach would be to store a list/array of post-ids of the posts which have been marked read by the user in his user_meta. Then retrieve this array for every logged-in user, and run the wp_query using the post__not_in parameter with the array as the argument.
You can use the loop_start hook which passes the $WP_Query object by reference. namespace StackExchange\WordPress; class editFirstPostContent { public function load() { if( \is_admin() ) { return; } \add_filter( ‘loop_start’, [ $this, ‘loopStart’ ] ); } public function loopStart( \WP_Query $WP_Query) { if( ! $WP_Query->is_main_query() ) { return; } if( ! isset( $WP_Query->posts[0] ) ) … Read more
After searching through two dozen blog posts I was able to combined several approaches and make this work. function my_search_by_title_only( $search, $wp_query ) { if ( ! empty( $search ) && ! empty( $wp_query->query_vars[‘search_terms’] ) ) { global $wpdb; $q = $wp_query->query_vars; $n = ! empty( $q[‘exact’] ) ? ” : ‘%’; $search = array(); … Read more
Try to remove this custom action-hook. add_action(‘init’, function(){ remove_action(‘pre_get_posts’,’wpcc_custom_posts_oderby’);; });
Custom Order Current Query: By Meta Key and Category
My first attempt to help you with solving your problem would be to do something like this : /* Order Posts Alphabetically */ function prefix_modify_query_order( $query ) { if ( is_main_query() ) { $query->set( ‘meta_query’, array( ‘relation’ => ‘AND’, ‘query_highlight’ => array( ‘key’ => ‘wiloke_listgo_toggle_highlight’, ‘value’ => ‘1’, ‘compare’ => ‘=’ ) ) ); $query->set( … Read more