Skip to content
IT Nursery
  • Home
  • Programming
    • PHP
    • C
    • C++
  • DataBase
    • MySQL
  • CMS
    • WordPress

pre-get-posts

pre_get_posts for exclude category

by IT Nursery

This code works perfectly function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-1’ ); } } add_action( … Read more

Tags pre-get-posts

How do I sort posts by custom taxonomy?

by IT Nursery

I am trying to sort posts by custom taxonomy. I have a custom post type which is course-cpt and I have created custom … Read more

Tags custom-taxonomy, pre-get-posts, tax-query

When querying a combination of posts and other meta fields, is there a better solution than directly modifying the WHERE value?

by IT Nursery

This question is a follow up to a question I recently asked. I’ve implemented what seemed to be the only solution, and it … Read more

Tags posts-where, pre-get-posts, wp-query

Including only current user’s posts in search

by IT Nursery

I am a new WP plugin developer. I want the search page to include only the current user’s posts. I first added a … Read more

Tags actions, capabilities, pre-get-posts, search, wp-query

pre_get_posts filter meta_query without conflicting existing meta_query

by IT Nursery

I have a meta_key on all posts that is designed to check the current user role and only return the post if the … Read more

Tags meta-query, pre-get-posts, wp-query

Two loops by pre_get_post on same page

by IT Nursery

I have two loops in archive.php, both are affected by pre_get_post. My code on pre_get_post is this: // My pre_get_post function my_pre_get_posts( $query … Read more

Tags loop, pre-get-posts

Skip first post on Category Archive

by IT Nursery

I have created a filter to skip first post of the archive on “podcast” category. Below is the code. add_filter( ‘pre_get_posts’, ‘amd_limit_posts’); function … Read more

Tags archives, pagination, pre-get-posts

Search by type posts and taxonomy

by IT Nursery

I want that my search page give results of posts (that i want that show) and taxonomy The code to get just two … Read more

Tags custom-taxonomy, filters, pre-get-posts, search

Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts

by IT Nursery

I have a category archive page (press), which I need to loop through posts of a certain tag (magazines). I tried to modify … Read more

Tags categories, loop, pre-get-posts, query, tags

Custom post type with tags

by IT Nursery

My understanding is, that custom post types can share tags with the posts also. I have created tags and applied them to a … Read more

Tags archives, custom-post-types, pre-get-posts, tags
Post navigation
Older posts
Page1 Page2 … Page13 Next →

Important Tag

.net admin ajax android arrays bash c categories comments CSS custom-field custom-post-types custom-taxonomy customization database filters functions git hooks HTML images ios java javascript jQuery menus multisite MySQL node.js permalinks php plugin-development plugins posts python Shortcode sql string theme-development themes uploads users woocommerce-offtopic wp-admin wp-query

Recent Posts

  • INSTALL_FAILED_DUPLICATE_PERMISSION… C2D_MESSAGE
  • How to sort by meta value?
  • WPF text Wrap vs WrapWithOverflow
  • How to retrieve the list of all posts ever published via the feed?
  • how to use javascript Object.defineProperty

android c categories CSS custom-post-types custom-taxonomy customization database functions git HTML images java javascript jQuery multisite MySQL php plugin-development plugins posts python string theme-development wp-query

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Content from: Stack Exchange

Important Link

  • About
  • Privacy Policy

IT Nursery

The Goal of ITNursery Engaging the world to foster innovation through aggregate information. Our Question Answer post, blog information, products and tools help developers and technologists in life and at work.

copyright © 2023 All Right Reserved | IT NurSery