How to query for posts (hierarchical custom post type) that have children but are NOT top level?

You can use filters to modify the SQL. I added something unique in the post_type so I could filter only this query and not change anything else. The query for example $query = new WP_Query(array(‘post_type’=>’something_unique_for_filter’)); And the filter function custom_where($where, $query) { global $wpdb; if(false !== strpos($where, ‘something_unique_for_filter’)) { $where = ” AND post_type=”page” AND … Read more

Archive Page for Multiple Custom Post Types

Let’s say you have custom post types cpt_a, cpt_b, cpt_c. You could make an archive page for cpt_a: archive-cpt_a.php. Then after the main loop, you could make a second loop for cpt_b like this: $cpt_b = new WP_Query( array( ‘post_type’ => ‘cpt_b’, ‘posts_per_page’ => -1 ) ); while ( $cpt_b->have_posts() ) : $cpt_b->the_post(); the_title(); endwhile; … Read more

WordPress rewrite url

But we are not limited to default formats, as WordPress allows users to customize the pretty permalink format by setting one or more structure tags. The custom structure option allows to set a highly customized pretty permalink format The custom structure option allows to set a highly customized pretty permalink format

How should i sort “Last Update” Custom Column?

orderby will not contain the title of the column that is being clicked on, but its ID. Change your pre_get_posts filter to function my_organization_orderby( $query ) { if( ! is_admin() ) return; $orderby = $query->get( ‘orderby’); if( ‘profile_updated_on’ == $orderby ) { $query->set(‘meta_key’,’profile_updated_on’); $query->set(‘orderby’,’meta_value_num’); } }

Custom Post Type setup

You can set any arbitrary path in the rewrite slug and has_archive arguments: $args = array( ‘rewrite’ => array(‘slug’ => ‘people/researchers’), ‘has_archive’ => ‘people/researchers’, // other args… ); EDIT Your post type slug is researchers, so WordPress will be looking for the file archive-researchers.php by default. If you want to force a different template, you … Read more