Tag Info

Hot answers tagged


With everything moving towards OOP programming with classes and the use of objects increasing and favored above the use of arrays as such, I would definitely go with returning results as an object. This just makes everything easier for future use But at the end of the day, you should always use what you are comfortable with within a set scope while keeping ...


Per comments, just use pre_get_posts filter (no query_posts()) very much as you have it with a few adjustments, eg test for $query->is_category( 'news' ) so that it only runs on news queries, and set the default to "2014" rather than bailing on no $_GET, eg function wpse129223_custom_meta_query( $query ) { // If not on the main query, or on an admin ...

Only top voted, non community-wiki answers of a minimum length are eligible