Function get_the_content
doesn’t take post_ID
as param. It has 2 params:
$more_link_text
– (string) (optional) Content for when there is
more text.$stripteaser
– (boolean) (optional) Strip teaser content
before the more text.
So you can’t use it as in your code get_the_content( $p->ID );
– this will get content of current post and use $p->ID
as more link text.
So how to get the content of any post based on post ID?
You can use get_post_field
function:
echo apply_filters( 'the_content', get_post_field( 'post_content', $p->ID ) );
Related Posts:
- How can i remove all html tags from get_the_content()?
- Changing the HTML Of the content
- append PHP function to the_content
- WordPress Wysiwyg Content not being displayed
- Go to / Scroll to Password Field on WordPress Posts After Submit With Message(s)
- Extremely slow pageload for long post when using the_content?
- Output 2 items within the Loop
- Wrap First Character after in a tag
- How to call function at the bottom of post using plugin?
- Output Buffering – Everything between wp_head and wp_print_footer_scripts?
- How do I Add HTML to the_excerpt() & the_content() Output?
- Showing content from one page on another
- Removing “wpautop” (auto tags) only on certain pages?
- Get URL from shortcode tag
- How to debug this search & replace strings snippet?
- Only first shortcode gets executed
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- How to hook code to show after the_content?
- Create a WordPress shortcode using PHP [duplicate]
- Get the_content surrounded by instead of
- How to turn each phone number within the $content to a telephone link?
- WordPress the_content Page Load
- Including Custom fields within the_content
- Strip from or something better?
- Problem in replacing the_content with the_excerpt()
- How to Create custom block for displaying information in content section which act like shortcode
- Give ID to divs inside the loop
- How to bind each “the_content” elements to a custom variables
- Replace an array (with identical values) with another array in the_content
- Is there a way to have chunks of a page’s content expire?
- Excerpt all post content Content Same Size without word cutting off
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Timthumb.php image gallery not working on Multisite WordPress
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- How do you create two separate Register pages?
- $_GET[‘updated’] does not work in WordPress 3.1?
- Why doesn’t PhotoSmash plugin play well with wp_query?
- How to send form data from WordPress (Meta Box) to an OData service?
- How to Configure Events List in WordPress to Disappear Event Once Date is Past
- Removing WordPress Footer -without access to PHP code?
- dynamic page using php from sql database
- Upload non-featured image to image field
- Usage of call back function of add_meta_box()
- Building a REST API for your web app exposes primary keys of DB records?
- WordPress get_media_embedded
- Change product_base programmatically
- wp_delete_comment takes two tries to delete – then deletes all comments
- php redirect with custom user roles set and working but redirect not working for when users are logged in
- how to get serialized post meta
- Hide Heading if ACF Field is empty
- Scheduling an event inside plugin class is not working
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- How to set a template with wp_insert_post
- WordPress Custom SQL Table with UserID Filter for results
- Automatically add images to a menu
- Display Yoast meta-description `wpseo_desc` within loop of categories and fail silently if no data is set [closed]
- Get access to variable from previous pageview, excluding ajax-calls
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- Permission callback to check if user has application password
- Load Posts on Click via Ajax into a DIV
- How to catch wordpress post ID when it’s published
- calling a custom field value inside functions.php
- What is the best way to define constant options for a theme?
- WordPress redirect redirecting too many times or not at all
- Can’t retrieve element with WordPress default @fetch_rss();
- set post limit at load more ajax wordpress
- I have a snippet to redirect all users to a maintenance page. How do I exclude users with admin role?
- php esc_html_e with an html link inside not working
- How to filter custom taxonomy term name, slug, and description?
- An audio player that showcase a random song from playlist every 24h [closed]
- how to prevent wordpress admin from logging in via woocommerce my-account page
- get_the_ID() in the footer returns wrong value
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- Trouble inputting variable into WP query
- How to get the last category name of a child category?
- Add html link in functions.php files of the theme
- How can I add a UTM tag with PHP code to pick up the post slug dynamically in the UTM?
- How do I include SVG file used as featured image?
- Use value from Ajax call in PHP function
- require_once() if a product in woocommerce contains a tag [closed]
- the_posts_pagination() not working in wpquery
- Automatic excerpt is not shown with the_excerpt() command
- Using ob_start and ob_get_clean with wordpress shortcode
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- Return product description
- How to add the sidebar to all the pages except the home page? [closed]
- Header not properly displaying on archive.php
- Custom meta box values are not getting saved for my custom post type
- Get the last 5 products from each category
- How to say if meta_value is greater than 0 in an array?
- Getting users with a specific meta data and then querying their posts?
- Why does the post_type_link hook everything twice?
- Adding a tag_ID column into Categories inside the admin dashboard?
- How to pass a variable into an add_filter() function?
- locale filter function running multiple times
- Multiple requests external data api dynamic block gutenberg
- Why does the Woocommerce grouped template prints the unpublished products?
- Woocommerce with Lazy Load php and ajax
- Adding conditional text to a PHP Shortcode Template
- How do I get the content excerpt of the recent post?