Using ACF values in nested WP queries for CPT with date values in the past

Your current meta query embodies the logic IF event_end IN range OR event_start IN range You need to account for the conditions of event_end‘s presence separately: IF event_end IN range OR ( event_end NOT EXISTS AND event_start IN range ) Immediately adjacent nested clauses with the same AND/OR relation can be combined, which might make … Read more

Faking “Same Slug Root, Multiple Custom Post Types” with Redirects?

You can have two CPT under a common “prefix” /potato/name-of-post-from-CPT_1 /potato/name-of-post-from-CPT_2 but you need to create custom rewrite rules and change links generated by WP for these CPTs. Links created for CPT can be changed with post_type_link filter. Before changing the link, check what format is in use, “plain” (http://example.com/?p=N) or “pretty permalinks” (http://example.com/page-name/). add_filter( … Read more

Custom Endpoint For Specific Custom Post Type

I noticed that your post type is hierarchical, so you could actually add page-attributes to the supports array in your post type args, i.e. ‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’, ‘page-attributes’), then you could create those sub-sections as child of your movie posts. But yes, the child posts will need to use unique slugs like news, … Read more

Display related CPT with custom taxonomy

I was building something similar a couple of years ago, here’s what I did, maybe it helps … (changed to your use case) $result = new WP_Query([ ‘post_type’ => ‘location’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1, // all of them on one page ‘tax_query’ => [ [ ‘taxonomy’ => ‘services’, ‘field’ => … Read more