wpdb->term_taxonomy count posts from both published and private posts?
wpdb->term_taxonomy count posts from both published and private posts?
wpdb->term_taxonomy count posts from both published and private posts?
You can get a post row by the ID global $wpdb; $mylink = $wpdb->get_row( “SELECT * FROM $wpdb->posts WHERE ID = 10” );
You’ve already named the clauses in your meta query, so you can reference these directly in the orderby argument: $query->set( ‘orderby’, array( ‘enddate’ => ‘DESC’, ‘startdate’ => ‘DESC’ ) );
Alter query with posts_clauses to retrieve NULL values last
order one custom post type by modified time of another post type
Thank you to Tom J Nowell for pointing me to using WP_Query instead of get_posts. With WP_Query you have the entire WP_Query object to reference. So something like the following gives the actual mysql query of the args I was using. // these same args also worked with get_posts() $args = array( ‘post_type’ => ‘post’, … Read more
You could adapt get_post_acestors(), and write a similar function for comments. Here is an example that returns the top comment’s id or false. Not tested! function get_root_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment || empty( $comment->comment_parent ) || $comment->comment_parent == $comment_id ) { return false; } $ancestors = []; … Read more
Protect sequence of pages with same password for each of two groups of users
Ordering by a metadata subfield in WordPress?
Maintaining Queries in URL