Orderby in Query Posts affected by operating system?

When these two values are the same, then your orderby statement does not tell how they should be ordered. In the SQL world, order is not an inherent property of a set of data. Thus, you get no guarantees from your RDBMS that your data will come back in a certain order — or even … Read more

Featured-Content/Featured Posts With Random Order

Third party themes are off topic, but I ended up checking it anyway: The Problem What comes before & after your posted code is important: Before: // Return array of cached results if they exist. $featured_ids = get_transient( ‘featured_content_ids’ ); if ( ! empty( $featured_ids ) ) { return array_map( ‘absint’, (array) $featured_ids ); } … Read more

pre_get_posts shows posts in random order sometimes

pre_get_posts is not a filter hook, it is an action. Also you should not set orderby to menu_order for posts as they are not hierarchical. Set orderby to date instead. function modify_query_amount_shown( $query ) { if ( $query->is_category ) { $query->set( ‘posts_per_page’, 30 ); $query->set( ‘orderby’, ‘date’ ); } } add_action( ‘pre_get_posts’, ‘modify_query_amount_shown’ ); Now … Read more

Check post_date in pre_get_posts

You can’t really check post_date in pre_get_posts, because, well, the action fires before (pre_…) the posts have actually been fetched (…get_posts). 🙂 But, you can use $query->set() to add date parameters to the query. This is taken from an example in the WP_Query() Codex entry: <?php function wpse54142_filter_pre_get_posts( $query ) { if ( is_feed() ) … Read more

Sort order of next/prev sibling page

I think in this case it is probably easiest to create your own function or two. I’m giving you a rough outline on how to do it below. // use the same filter to get the same results add_filter( ‘posts_fields’, ‘wpcf_create_temp_column’ ); add_filter( ‘posts_orderby’, ‘wpcf_sort_by_temp_column’ ); // perform query $q = new WP_Query( [ ‘post_type’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)