Two loops by pre_get_post on same page

It will be good to know how you implement your code in header.php. You can try to move some condition to not affect all query? function my_pre_get_posts( $query ) { if ( is_admin() || ! $query->is_main_query() ) return; if ( is_post_type_archive( ‘propiedad’ ) ) { Becomes function my_pre_get_posts( $query ) { if(!is_admin()){ if ( is_post_type_archive( … Read more

Skip first post on Category Archive

Have a look at the WordPress Documentation available here, you’ll be able to do what you want to do by using two hooks: https://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination Unfortunately, many developers find out that hard way that setting an offset value in their custom WordPress queries has the nasty and potentially serious side-effect of breaking pagination. There is a … Read more

Search by type posts and taxonomy

You can add a custom tax_query to your filter, and pass the search query to it: function searchfilter($query) { if ($query->is_search && !is_admin() ) { $s = $query->get( ‘s’ ); $query->set(‘post_type’, [ ‘lesson’, ‘series’ ] ); $query->set( ‘tax_query’, [ [ ‘taxonomy’ => ‘your-taxonomy’, ‘field’ => ‘name’, ‘terms’ => $s , ] ] ); } return … Read more

Why am I getting a 404 on anything past page 1 of my query?

So, it turns out my hunch was correct and the solution is to add some rewrite rules. Here’s what I added: function owr_blog_rewrite( $rules ) { return [ ‘notes/topic/([^/]+)/?$’ => ‘topic=$matches[1]’, ‘notes/topic/([^/]+)/page/([0-9]+)/?$’ => ‘topic=$matches[1]&paged=$matches[2]’, ] + $rules; } add_filter( ‘rewrite_rules_array’, ‘owr_blog_rewrite’ ); Everything works as expected now

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)