It seemed like you did not call wp_reset_postdata()
which in short, restores the context of the template tags (e.g. the_title()
and get_the_title()
) from a secondary query loop back to the main query loop.
More details at https://developer.wordpress.org/reference/functions/wp_reset_postdata/#more-information.
So basically, you just need to call wp_reset_postdata()
like so, and then the issue in question would disappear:
echo '</ul>';
// Restores the $post global.
wp_reset_postdata();
// Now this should show the correct title.
echo '<h2>Más datos de ' . get_the_title($post->ID) . '</h2>';
Related Posts:
- Custom Post Type and Taxonomy URL rewrite
- Set relationship between custom_post_types
- How to build a complex page structure
- Remove admin menu for custom taxonomy attached to custom post type
- How do I list custom taxonomy terms without the links?
- Page not found taxonomy custom post type
- How to list custom taxonomy categories?
- clients list using wordpress
- Custom taxonomy query for a custom post type
- Extend walker class with custom post types [closed]
- How to do a custom bookmarks post type?
- How to get_queried_object on multiple objects?
- Count number of posts which exist in 2 taxonomies?
- Getting taxonomy terms used by custom post type
- How to display Custom Taxonomy of Custom post type
- associate custom post type with tags with specific pages
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Removing Duplicate Custom Taxonomy Terms from within a Dropdown Select?
- How to customize admin posts based on the user who is logged in
- taxonomy template for custom post type the same as the archive
- Get categories and descriptions from custom post type
- Custom taxonomy template for multiple custom post types
- Custom Post Types for Support Ticket plugin?
- Add/Remove current_page_parent class
- Repeating posts when paginating random posts
- Use different taxonomies in different custom post types’ permalinks?
- Query/list all terms and their custom post count
- Search Custom Post Type & Taxonomies
- Get custom taxonomies from multiple posts
- How can I make a custom post type sticky?
- Help need making decision. Ads rotating site on wordpress
- Categories of custom taxonomy don’t show any posts
- Get Taxonomy Term Title by it’s URL
- Is it possible to have dedicated page for parent/child taxonomy?
- Can a Custom Taxonomy be named “category” like normal Posts?
- How to use terms from the same custom taxonomy in different roles in a custom post type?
- How to have the same url structure for both a CPT and a Taxonomy?
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- limit value taxonomy based on previous taxonomy value wordpress
- Limit number of custom posts per taxonomy
- Number of Custom Post Types published are not being shown in the custom page
- Load Custom_post_type categories post with ajax
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- How can I get this request to use the Custom Post Type page template instead?
- Include custom taxonomy term in search
- Why is my WP_Query outputting my entries twice?
- How to solve this custom post type goes to 404 page?
- custom post type and custom taxonomy
- Custom Post Type with Custom Taxonomy as Category
- WP_Query() with custom post type and taxonomy — get all terms?
- Why does my taxonomy have a category style div id?
- Get custom post type categories to show up in menus
- Custom Type add Transitions
- How do I get the custom category URL from the custom post type?
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- How to loop through custom taxonomies and sub taxonomies and display posts?
- How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]
- Custom post type name and assigning custom taxonomy
- Building a Portfolio and need some direction
- Custom Post Type Custom Archive Page Not Working
- Enabling permalinks disables custom page template
- Correct way of adding taxonomy to a custom post type
- Query Custom Post Type by Taxonomy
- WordPress custom taxonomy page
- Related “custom post type” using “custom taxonomy”
- How to create Custom Taxonomy Search Drop Down for specific Post Type
- Can I set the post_type query_var as a link is clicked?
- How do I disable the built-in editor and automatically configure the properties of new pages?
- How to have multiple search result pages in wordpress with taxonomy terms listed
- Remove cpt slug from url and use custom taxonomy instead breaks all other cpt
- Set priority to permalinks
- How to list posts by terms
- Changing CPT permalink
- Custom post type structure + permalink structure
- CPT UI: Connect a custom post type to a custom post type
- List posts of custom post type under category name
- Custom post type and taxonomy same slug
- Single taxonomy for different custom post types
- What’s the most efficient way to get two queries based on an if statement?
- Display a Custom Post Type within another with hierarchically slug
- Custom Post Type rewrite url to /category/pagetitle [duplicate]
- Custom Post Type Taxonomy – Permalinks generating, but posts not found
- Decrement term in for each
- WordPress custom post type advise
- Custom Post Type and Taxonomies, creating the corresponding template file and loop the data
- Generating List of Tags from Custom Post Type
- Post data in separate divs with incrementing class using WP_Query
- Get term_id for each instance of custom taxonomy
- How to list groupings and keep pagination
- Custom Post Types and Taxonomies
- install.php Custom Taxonomy Term not being added to custom post
- How to retrieve taxonomy terms of the current custom post?
- Custom Taxonomy in Permalink from post type
- How to add taxonomy in menus?
- WordPress and Unity high scores table
- Separating a custom taxonomy from blog post-type
- Custom post type with new taxonomy [duplicate]
- Custom post type / Filter by letter
- Custom Taxonomy Tags and Category using same slug