CPT-onomies CPT_TAXONOMY->get_terms extremely slow with 6K posts
CPT-onomies CPT_TAXONOMY->get_terms extremely slow with 6K posts
CPT-onomies CPT_TAXONOMY->get_terms extremely slow with 6K posts
Resetting permalinks, as per this thread, fixed this problem. Visit Settings -> Permalinks -> Save current settings
If you take a look at get_terms() documentation it accepts search argument, which will perform LIKE match against term name and slug.
Why that $pages suddenly became $myposts!!? Anyway, I really don’t see any big issues with your code, however, you can try this.. <?php $pages = get_posts(array( ‘post_type’ => ‘directory_listing’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘place’, ‘field’ => ‘slug’, ‘terms’ => ‘place1’, ‘include_children’ => false ) )) ); foreach ($pages as $page) … Read more
If you are trying to display a list of post that belongs to two or more taxonomy terms, you are using the wrong URL. If your are usgin pretty permalinks, it should be: www.example.com/service-provider/?service=electricians&area=north-shore-lower If you are not using pretty permalinks, it should be: www.example.com/?post-type=service-provider&service=electricians&area=north-shore-lower Anyway, you are expected to be in multitax archive page … Read more
you can do this using the plugin “Advanced Custom Fields”, just create a field type “post object” and them associate this field with the “Work” custom post. Later in your template, you can get the artist data, a object with all elements by your custom post named Talent. Advanced Custom Fields have a great documentation … Read more
Here’s what I would do: I would create a new WP_Query instance, using a Taxonomy parameter as follows: $wp_query = new WP_Query([ ‘post_type’ => ‘<custom_post_type>’, ‘<taxonomy_slug>’ => ‘<term_slug>’, ‘fields’ => ‘ids’, // We just need the post IDs // Add other query parameters as needed ]); More on using Taxonomy parameters in a WP_Query instance … Read more
If I understand correctly you want to get the taxonomies associated with a custom post type object, not with a specific single post. To do that you can use get_object_taxonomies(). For example, to get the names of the associated taxonomies to “my-custom-post-type”: $taxonomies = get_object_taxonomies( ‘my-custom-post-type’, ‘names’ ); foreach( $taxonomies as $taxname ) { echo … Read more
You can grab the ID’s of all children and set the post__in argument for your tax query: $child_ids = $wpdb->get_col( “SELECT ID FROM $wpdb->posts WHERE post_parent = $post->ID AND post_type=”page” ORDER BY menu_order” ); $args = array( ‘post__in’ => $child_ids, // Only retrieve taxonomy posts that are children of this page ‘tax_query’ => array( array( … Read more
WordPress hiding posts without content on custom taxonomy query. How to solve?