WordPress Developer Ukraine, Kyiv
Find posts published in a specific date range using WP_Query

Find posts published in a specific date range using WP_Query

Date-based post retrieval is a common requirement in WordPress development that many developers solve less elegantly than they should. Typical use cases include a “This week’s posts” sidebar widget, an “Articles from last month” archive section, a year-in-review landing page that lists everything published in a calendar year, or an events-style content type where posts…
Query posts by custom taxonomy term in WordPress

Query posts by custom taxonomy term in WordPress

WordPress taxonomies are one of the most powerful content organization tools the platform provides. Categories and tags are the built-in examples, but developers regularly register custom taxonomies like genre, location, brand, or project-type alongside custom post types. At some point in almost every WordPress project you need to fetch all posts that belong to a…
WP_Query Loop: Incorrect Sort Order with AJAX Filters

WP_Query Loop: Incorrect Sort Order with AJAX Filters

A custom WP_Query loop with AJAX-based sorting works correctly for one post type but produces wrong order for another. The sort arguments look right. The most common cause is a third-party plugin — specifically one that overrides the default post order at the database level.
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…