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
- Display current category title on category page
- How to get the custom header image’s alt text?
- PHP unit testing WordPress?
- WordPress GET parameters causing 404 Not Found
- is_page() not working from within a plugin
- Metabox repeating fields – radio buttons not saving correctly
- Create WordPress pages with PHP
- How to return the_excerpt (without echo)?
- How to handle a custom form in wordpress to submit to another page?
- Is it possible to generate a page without create in the admin?
- Replacing mysql_real_escape_string in WordPress theme
- TCPDF get_post_meta outside the loop
- Database “Migration” for Plugins?
- WooCommerce Link to Product Category
- Easiest way to show total number of subpages
- using woocommerce_template_single_add_to_cart in shop-loop – javascript issues [closed]
- ACF check if variable has http, if else return string
- Can’t load WP function into external function
- Woocommerce – Filter Variable Products by Variation Attributes and Variations Regular Price
- Loading header.php on specific page
- Adding a div at the bottom of a sidebar
- How can I set a default category for a custom post type in wordpress?
- Sort posts by custom fields value using dropdown menu
- Cause of Blank Lines Being Added to WP FIles?
- PHP Fatal error: Out of memory in WordPress [closed]
- add_cap not working
- Weird 404 URL Problem – domain name being placed at end of urls
- Styling my own password protected page, how to deal with wrong password?
- Help solving t_echo php error while using echo do_shortcode
- How does WordPress interpret the php code?
- How to execute html code inside php?
- After adding my website to a new server, I keep getting a unexpected end of file error, but the file is identitcal to it’s original source
- Include js script ONLY on woocommerce product category pages? [closed]
- How to hide specific categories from contributors
- PHP $_REQUEST array empty
- how to enqueque code in a php file from functions.php
- How to get all the items of a taxonomy even if it does not have a custom post type?
- Displaying Overlay images over thumbnail of category type?
- Strip hashtag off permalink with php
- Uses for function: wp_update_user
- In adding CMS functionality to static website, is complete conversion the only way?
- How can I add diffrent editable text fields?
- How can I check if a post with a particular slug or title exists?
- I want to retrieve the email or username data entered for password reset, but failed. how can I do it?
- Error establishing a database connection (configuration)
- ACF – Can’t get custom post type by taxonomy
- Update user meta when an external link in admin notice is clicked
- Is there an option to execute javascript file only on plugin activation
- update_post_meta Not Processing Array Data (Not Sure What I Am Missing)
- WordPress randomly redirects with 301 after logging in
- append data to mysql table via submit button coded in php – not working
- When working with a post, almost all wp_postmeta are deleted
- How to tell if a page has subpages for Custom Post Types
- Why transition_post_type hook is called twice for the same post?
- How to do a MySql query in WordPress?
- “Page Array” displaying in title bar on Front Page
- Facebook like update status for wordpress
- Custom Taxonomy Link Text Echo Name Not Slug
- Find trigger behind occasional php undefined error
- Permission error on plugin save
- Restricting Post Content Visibility with Custom Code – where to put it?
- Highlight main menu when on specific posts or pages
- Adding Gravity Form With if(is_page) Is Not Working
- Implement “No related posts for this entry” into the loop?
- wc_add_notice not working on cart page
- Twig+WordPress how to use array arguments inside a function?
- I would like to alert message while another user is editing or update data in wordpress admin panel, what should i do?
- It’s not showing full content for posts pages in wordpress “[…]” while customing some changes in the style.css file [closed]
- AJAX WP_Query’s order and orderby parameters not working