the_title
filter takes two parameters, one of them is the ID of the post for which it was called. Something like that should work.
add_filter( 'the_title', 'se385007_title_filter', 20, 2 );
function se385007_title_filter( $title, $post_id )
{
$new_title = str_replace( "[geo_name]", "[geo_name post_id=$post_id]", $title );
return do_shortcode( $new_title );
)
Related Posts:
- explode array within shortcode
- Change behavior of “Insert into Post” based on attachment metadata
- Add new “Insert Into Post” button with another function
- How to add a theme custom variable to a post title?
- Call a custom field in an audio shortcode?
- wp_editor in add_meta_boxes does not show gallery
- Custom field for default gallery
- Execute/Parse Shortcode in Native WordPress Custom Field Value Field
- Title and post URL based on custom fields?
- Audio player shortcode not showing up when using variable
- Create WordPress shortcode with php code inside
- Display WP-Types custom fields in post [closed]
- Should custom meta boxes be able to output shortcodes the same as WordPress’ native post editor?
- Shortcode To Display Post Custom Field Value Inside Excerpt
- modify wordpress caption shortcode
- How to create a shortcode to print specific values stored in a post meta array?
- Insert a custom field into a shortcode and use it in post(s)
- Custom wysiwyg editor doesn’t execute shortcodes?
- Split the_title
- Custom Field 101
- shortcode in a custom metabox
- Can data from a Custom Field data be used by a shortcode on a per page/post basis?
- How can I modify RSS item titles to be either the title or a custom meta field?
- custom field (video/audio url) and embed functionality
- How to I make my post title link to a custom field
- IF Custom field value equals ZERO
- Display MP3 as media using an URL from a custom field
- Using a custom field inside a shortocde
- Enable a short code in the custom meta field
- do_shortcode close
- Plugin or shortcode for ISBN number?
- Best way to achieve multiple links in a post title
- How to pass custom field value to shortcode?
- Replacing custom field with shortcode
- Move the post title to another field
- Shortcode for Custom Field of Media Attachment (to use with Featured Images)
- how can i show WordPress custom field data to my short code?
- Search fails when using the radio buttons
- automatically add custom fields to post title
- Create Shortcode shows only posts with custom_field meta
- Output Custom Field value to shortcode
- PHP and Shortcode Combination
- Stop truncation of shortcodes in custom text fields?
- Retrieving Advanced Custom Field within Shortcode Function [closed]
- Using ACF Custom Field value in a URL with do_shortcode() [closed]
- Running a Gallery Shortcode in a Custom Fields Widget
- Decouple page name from page title
- Custom field in a shortcode?
- Display meta data from a custom field within plugin Category Grid View Gallery
- Insert wp gallery shortcode into custom textarea
- Displaying shortcode content inside custom field without images
- Parse Shortcodes in Theme’s Custom Field?
- Insert shortcode before and after a list automatically
- Retrieving custom field as shortcode
- Custom fields doesnt work well with any postTAB plugin
- How to include custom field in shortcode (do_shortcode) in theme file
- Shortcode not picking up custom field
- WP Query Args – search by meta_key or title
- Having different sidebar content for MANY pages?
- How can I fetch CSS from JSON WP REST API response
- How to set a default meta value for custom field
- How I check if the same post slug has not been used before publishing?
- How To Create a Metabox of HTML Content with Instructions For Editors When Editing a Post or Page?
- Calling Specific Pages with wp query Part II
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- If value present, order posts by two consecutive custom fields
- Copying Custom Meta Values from existing post to a duplicate post
- List posts with common custom field value
- Create Posts using Import>RSS/WXR/XML and pass values to Custom Fields
- Importing users to Buddypress with custom fields
- How to save a ToggleControl value in a meta field?
- How to get customfield value by woocommerce product ID
- How do I get the url slug inside the dashboard for a custom post type?
- how to upload a image from frontend with wp_insert_post and also update_post_meta?
- Uploading PDF using Media Uploader
- Why orderbyb meta_value_num won’t affect the generated SQL Query order?
- Sorting editor screen items
- get post id using custom filed value
- How Do I Display A Custom Field In The Sidebar Of All My Pages?
- Query_posts with custom field meta value
- Buik update custom field values from external API
- award points to a user each time they update their cpt post
- TinyMCE custom button retrieve value from custom field
- Update post meta data (custom field) by post link
- Changing order in which custom fields appear in dashboard
- Let Users Filter Posts by Custom Fields
- Run Function if Order Meta Exists – WooCommerce
- Expire Date Condition not Working ACF WordPress
- trying to add extra field using hooks
- Can’t set custom meta fields for a post
- Hiding Dropdown Fields
- Text in header as a page – hide from Web crawlers
- When post is updated, custom metadata in text area field is overwritten
- Fetch data from a WP page with same name as current username
- Getting content from custom fields of different pages on a single page
- Custom Fields – How can I remove the publish option for certain users
- Can i categorise my meta box?
- When editing a post with a custom meta box the values aren’t displaying correctly
- Function to retrieve a picture if there is no picture is attached
- Extract array from custom field