WordPress Developer Ukraine, Kyiv
Add Built-in WordPress Tags to a Custom Post Type

Add Built-in WordPress Tags to a Custom Post Type

How to add the built-in tags to a custom post type When most WordPress developers need something like post tags for a custom post type, they register a new taxonomy. But this is not always convenient. A custom taxonomy is a separate list of terms that lives only in that post type, and you also…
WP_Query Loop: Incorrect Sort Order with AJAX Filters

WP_Query Loop: Incorrect Sort Order with AJAX Filters

WP_Query loop: incorrect sort order with AJAX filters A custom loop with AJAX filters sorted posts correctly for one post type and incorrectly for another. The query arguments were the same, which was a mystery at first. The culprit turned out to be a plugin that changes the order of posts for the post types…
WP_Query: Advanced Techniques and Common Patterns

WP_Query: Advanced Techniques and Common Patterns

WP_Query: advanced arguments for real projects WP_Query is the main way to get posts in WordPress. Beyond post_type and posts_per_page it can combine taxonomy conditions, filter by custom fields and dates, sort by a field and exclude posts. These are the patterns that come up in almost every project.
How to Query Posts by Custom Field in WordPress (meta_query)

How to Query Posts by Custom Field in WordPress (meta_query)

Query posts by custom field with meta_query Custom fields are often used for things you later want to filter by: the city of an event, its date, a “featured” flag. WP_Query can filter by them with the meta_query argument, from a simple equality check to ranges and several conditions combined with AND/OR.
How to change arguments of the global query on default pages

How to change arguments of the global query on default pages

Modify the global WordPress query on default pages pre_get_posts fires after the query variable object is created but before the database query runs. It gives you direct access to the $query object for every query WordPress makes, including the main loop, so you can change arguments without duplicating the template or creating a secondary query.