In order for the template tags to work the global $post variable needs to be set properly, your $post is probably local to the loop or file.
Put somewhere before the loop global $post
But realy, just don’t do it, all the functions you use there can accept a post object or post id as parameter and there is no need to use globals. something like
foreach( $post_objects1 as $p):
?>
<h1><a href="https://wordpress.stackexchange.com/questions/214731/<?php echo get_permalink($p->ID); ?>">Title is <?php echo get_the_title($p->ID); ?></a></h1>
<?
endforeach;
Related Posts:
- why doesn’t the_content() work in this {single-custom_post_type.php} page?
- Get permalink and title by post name?
- Multiple templates for single custom post type
- help
- Getting custom post type author and date published
- Calling the first & last post by category in custom post type
- Tags results not displaying for post types
- Add Custom Fields to Custom Post Type RSS
- Do I need a nonce field for every meta box I add to my custom post type admin?
- Restrict custom post type to only site administrator role
- Check if a custom taxonomy archive page is being displayed
- How to limit the number of terms (terms acts like categories)
- Removing custom post type from link search results
- Search multiple custom fields by using meta_query
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- Filtering Posts by Multiple Taxonomy Terms such as in an Admin Post Listing?
- How do I Make a custom post type get a custom post template in a plugin
- Check if current user has post in post type and is author role
- How to create download links based on Custom Fields with Rewrite API
- Adding Sticky functionality to Custom Post Type Archives
- Pagination on a custom page template
- Add multiple Visual Editors for Custom Post Type
- On clicking on the category name the page is redirecting on 404 pge
- Adding a span when custom post type is updated
- Category base to url in custom post type/taxonomy
- Pull image from ACF field in a Custom Post Type
- Paginated Taxonomy Term Archive including one post per term
- List posts AND custom post type by category
- add_image_size for post type
- Is it possible to use pages to apply static content to each taxonomy level?
- Archive page for custom post type not working
- Retrieving list of Custom Post Types
- How to remove default tag and category options form a custom post type admin menu
- Save an array from drop-down in custom meta box
- Custom meta box not saving
- How to display selected taxonomies by their parent
- How to create shortcode to display custom field value on a custom post type
- How to restrict users and admin from creating new taxonomy terms?
- Convert simple SQL Query to WordPress query
- How can I run this code once so that my generated post title doesn’t keep changing on publish/update?
- Order query using custom meta data
- Get latest 3 posts from multiple CPT in one query
- Get taxonomy values based on wp_query results
- Categories of Custom Post throws gives 404
- Ajax Custom Post Filter is not filtering
- Need Output Custom Taxonomy from Custom Post Type
- Woocommerce search pagination not working
- Completely remove custom post type permalinks (“One Page” website)
- WordPress custom post type split into pages
- Permalinks: custom post type -> custom taxonomy -> post
- How do i search authors from search form using author’s name
- Custom Post Types hierarchy and rewrite
- How do I know the ‘meta_key’ for ordering my custom post type
- How to get the intersection of two terms both from different custom taxonomies
- Facebook social publisher and custom post type fields [closed]
- Custom post type’s permalink adds the name of the post type before the post name
- Which custom post type does the current post belong to?
- Custom post type showing same Post on all Pages
- WordPress Custom Post Type – show only certain posts that have specific taxonomy set
- get parent content inside child posts
- How to get specific post meta by title or id
- Why are some of my custom posts not showing up on my page?
- display custom taxonomies limited to custom post type?
- Populate a custom field dropdown with post titles by author
- Use core block functionality in a custom block gutenberg
- Add form after woocommerce admin order edit
- Get assigned post categories
- How do I show a link or ‘Read More’ button on a custom field excerpt when it is less than the word limit
- Custom Post Type and Taxonomy Loop Output Is Wrong
- Multiple custom post types showing up in edit.php
- How do I get the index for a custom post?
- Commas not displaying in implode
- “Cannot redeclare cpt_reg_tax()” because of functions.php
- custom taxonomy listing returns no posts
- Custom Post Type and Breadcrumbs Conflict
- Writing a custom Glossary plugin
- Reveal Foundation modal displaying repeat content on all modal rather dynamic content
- How to show Custom Post Types under Taxonomy in a new WordPress page template?
- How we can create menu from Appearance > Menu and use as a add-submenu-page for admin menu?
- Custom Post Type Category Displaying ALL Sub Categories as well
- How to only display all posts to a custom User Role?
- register_rest_field update_callback don’t work for $_FILES
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- Can I organise my custom post types by page?
- Display posts of a hierarchical custom post type excluding parent posts
- Wrap an X amount of taxonomy posts in a separate Row in WordPress
- Best Plugins for Complex Index of Resources [closed]
- Looping through custom taxonomy in one template
- How Can a CPT in WordPress have a page 2 without an error?
- Get the custom post type slug but remove the rewrite prefix?
- Site loads very slow for archive custom post type page
- WordPress loop for multiple custom post types
- How can I base a query off of the current page post type AND a meta value from another custom post type
- How to bring custom meta boxes to custom post types?
- Plugins for putting Custom Post Types into the Menu
- Fallback if statement based on the number filtered from it
- Custom Post Types, Taxonomies and Terms… I’m getting confused now!
- Don’t display post if post has empty body
- Posts picking up old Permalinks, how to reset?
- How to query posts by category with the_title();