Tag Info

Hot answers tagged

3

You can use 'posts_orderby' filter to change the SQL performed. Note that: using get_posts() you need to set 'suppress_filters' argument of false for the filter to be performed if you don't explicitly set 'post_status' you'll get only published posts (so no much to order) Code sample: $filter = function() { return 'post_status ASC'; }; ...


2

pre_get_posts does not explicitely changes the value in the db of posts_per_page, this value stays constant to the value set in the back end under the readings settings. pre_get_posts only changes this value before the SQL query is build in WP_Query right before the main query runs. If you need to get the exact ( more specific ) amount of posts per page set ...


2

You can try the following (untested) mini plugin: <?php /** * Plugin Name: Support for ignoring the default menu order in WP_Query * Description: Uses the _ignore_default_menu_order argument * Plugin URI: http://wordpress.stackexchange.com/a/193291/26350 */ add_filter( 'posts_where', function( $where, $q ) { global $wpdb; if( (bool) ...


1

parent is your answer here. Every term have a parent value set in its parent property. This value is an integer value, and represent the term id of its parent term. All top level terms have a value of 0 which just simply means it is a top level term First we need to build an array with parent terms and the specific terms from get_the_category. We will skip ...


1

You can try this: $query = new WP_Query( [ 'wpse_pid' => 100, // Our custom post id argument 'wpse_compare' => '>', // Out custom compare argument (<,>,<=,>=,!=,<>) 'posts_per_page' => 100, // Modify this to your needs ] ); where we use the following plugin ...


1

After hours and hours I finally figured it out. I only had to replace wp_reset_postdata(); with $cust_loop->reset_postdata();



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