If you put a unique placeholder value there, you can do a find/replace via the_content
filter, which runs after the shortcode is rendered, but before the content is output in the template.
For example, this will replace any occurrence of replacethisthing with the post ID:
function wpd_replace_something_in_the_content( $content ){
return str_replace( "replacethisthing", get_the_ID(), $content );
}
add_filter( 'the_content', 'wpd_replace_something_in_the_content', PHP_INT_MAX );
Related Posts:
- Stop WordPress automatically adding tags to post content
- WordPress removing tags?
- Update all posts automatically when using post_meta
- Search & Remove Specific Shortcode From All Posts
- How to display comments and comment form on custom post type?
- Shortcode Not displayed at the Right Place [duplicate]
- I am trying to create a simple frontend form for posting
- Automatically added brs and paragraphs?
- Specific loop in Shortcode
- POST from jQuery to PHP
- How to add shortcode tags in single.php [closed]
- Phantom 302 status code when sending a POST requests on pages
- How To Add Perfect Apostrophe And Quotation Mark In WordPress Posts?
- Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}
- How to create shortcode to show the 2 latest posts
- Hide Post comments when displayed via WP_Query
- How to automate filing a form as a user
- Remove Shortcode […] from Blog Preview
- Submitting POST data to a custom page template triggers a 404, why?
- Display a post by ID attribute with shortcode
- UberMenu list current user’s posts as menu items
- Ajax posts filter by date, comments, top views, top likes
- Duplicating Table of Contents for Paginated Post
- Query how many items to show in shortcode
- do_shortcode within post query
- Is it possible to create a form post wordpress custom navigation link?
- How to get rid of shortcodes in post content once and for all
- get_the_content(“more…”) returns full text
- Redirection not working in this front end post submission form?
- Is there a straight-forward way to iterate over all shortcodes in a post?
- How can i display gallery shortcode output under Post text
- How to display Common posts from specific Tag & Category with Shortcode
- How to build a site with a map that shows where people offer and need help?
- CF7 upload file failing [closed]
- How to convert contact form 7 submission to post after submission? [closed]
- What’s the best way to render Visual Composer in posts, not pages?
- display-posts shortcode attributes have no effect
- How to convert query sql to shortcode in wordpress?
- How can I add 2 buttons with shortcode
- Why aren’t paragraphs breaking on this page?
- HTML Inside of Shortcode Breaks Shortcode Output
- Shortcode for tables which can include comma and linebreaks
- post/page content
- In admin panel, use a form to create a post?
- Standalone form does not post to the url when form fields are populated (otherwise it does)
- Mailing list submission from a post that doesn’t have a form on it
- How to let a user create a post by submitting a POST form?
- Change published date and time using SQL query for page in every 5 hour
- What parameters do I need to pass to get_tags to get ALL tags for the site, when used in a post
- Shortcode for Comments and Comment Boxes in Post Loop
- get category in list of posts // shortcode for custom related posts
- shortcode // get posts by ids
- Display “no post” message
- How can I create a shortcode to show the number of posts of actual day?
- How can I pass form entry to another form on a new page
- Not adding a new post?
- Featured Story Shortcode not outputting content
- Function is printing twice – any suggestions?
- How to pull sticky post permalink inside php?
- Redirecting wordpress search query to archive page
- Contact Form 7 Shortcode not recognized inside another shortcode
- Display Post from Custom Post Type with Shortcode
- wp_insert_post() Add and specific ID to the body of that
- How can I create a Survey Form in WordPress that users can fill in and then submit the entire survey contents as a post?
- WP Ajax returning 0, can’t find action
- Add a url parameter to the current post and read it in a shortcode
- Creating a frontend blog post form for logged in users only
- I need show posts by customer (Shortcode)
- Ajax the create and edit post form into lightbox and get results
- Is it possible to query a category with specified posts?
- Shortcode: How to add custom posts?
- Display result of custom form
- Changing a field value on submit using a PHP variable
- Add category attribute to custom recent post shortcode
- Save/retrieve form data best practises for theme development
- Shortcode for printing post titles
- How to use extract shortcode in loop?
- form to post multiple inputs into post_content
- Using Post ID and Page ID in same function
- Display only posts with comments
- User driven content problems
- Change the default video URL in a post to shortcode format
- How do I insert a custom field in a user submitted post?
- Can’t assign another category other than Uncategorized int he following front end post submission form?
- Get Video Attachment to post
- How do I add an article to specific page?
- get value from post to sidebar
- WordPress Yoast SEO plugin Post Save/Update Issue
- If post has non-shortcode string
- Insert Shortcode exactly at the end of the content
- Trying to create shortcode listing custom posts, but formating not being included
- How can I add a custom caclulation form in post?
- Filter/Sort Post Form On Taxonomy page
- Simple shortcode to check if a user has commented on a certain post
- Undefined Function Fatal Error with Shortcode [closed]
- How to use shortcode to get the second to newest post?
- Code understanding
- How can I strip a single tag from an email post
- How do you export and import wordpress blog posts and exclude pagebuilder shortcodes?
- Shortcode in loop always display data of first post on the page