Rather than finding the custom field value when the user hits the button, change the [custom field value] to a shortcode name (perhaps “[mkay_subscription_button_value]”?) and then create a shortcode that can replace the value of that key with the post’s custom meta. Something like this:
function 246286_display_custom_field( $atts ) {
$data = get_post_meta( get_the_ID(), 'mkay_custom_field', true );
return $data;
}
add_shortcode( 'mkay_subscription_button_value', '246286_display_custom_field' );
The value of doing this is: if the post’s custom meta changes after the button has been pressed, the output on the page still remains valid.
Related Posts:
- Using TinyMce with textareas in meta boxes on custom post types
- Auto sort the wp-admin post list by a meta key
- Show Custom Comment Fields when editing in admin
- How to activate “custom fields” section in WP3
- Custom text-only header
- How To Create a Metabox of HTML Content with Instructions For Editors When Editing a Post or Page?
- How to load php file for specific page in admin?
- TinyMCE Autoresize
- Why does this Quick Edit checkbox save the value only when unchecked?
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- Can you ungroup Custom Fields?
- Add WYSIWYG to Image Description field
- Add field to ‘Add User’ admin page
- How can I enable a TINYMCE rich text editor in the admin interface?
- How make a custom search on backend in WordPress without plugin?
- Custom Fields – Taller editing area
- Speed up / Optimize Admin Edit Post Page on Large Websites (50-150k posts, 50 custom fields per post)
- Custom Meta Box (SELECT) Not Saving
- How to load an assets based on custom field value?
- Customizing WP user profile with custom fields
- Auto embeding Vimeo/Youtube in custom fields (tinyMCE editor)
- Multiple instances of TinyMCE are removing tag
- How to validation for sanitize_URL?
- Make separate text boxes for separate WordPress Custom Fields
- Search & column order by meta value in admin
- How to I change the value of a custom field on the home page?
- Sort custom fields in admin by last field added
- Make custom user_meta as permalink for post
- Custom Field select list is truncated
- Cannot get tags working from a WPAlchemy metabox with wp_editor()
- Add custom fields to specific menus
- How to make donation button dynamic on chariti theme [closed]
- How to add a custom field in the advanced menu properties?
- Sortable Custom Columns in User Panel (users.php)?
- Importing data for advanced custom fields plugin?
- Gutenberg add a custom metabox to default blocks
- How to rename a custom field?
- Adding Custom Field to Taxonomy Input :Panel
- How to filter or search the posts using postmeta tables custom meta fields with wordpress REST API
- Add meta data to the menu
- How can the tinyMCE dom be manipulated (offical API does not seem to work)?
- Copy SEO Meta Desc “Custom Field” to Excerpt field?
- Custom fields won’t display on my blog page
- How to customize default wordpress editor?
- Order Custom post type loop by custom field (datepicker)
- Localized Date Format for Custom Field
- Check if the value of a field has changed on save_post
- How to edit multiple post with Custom fields
- Undefined index error when saving content on metabox
- Saving custom image meta fields
- TinyMCE – Add button that changes direction of selected text
- How to update custom user meta field in wp?
- Query post order by post and desc not working
- If category then echo a custom fields
- How can I show custom fields in the loop only to specific user roles?
- Add conditional custom option to ‘Display name publicly as’ dropdown
- Custom fields not getting saved in the databse when added to the add new user profile page
- Show 1 post and after a specific date show the next one
- How to order posts by one custom field and filter them by another one?
- Can we create a WordPress read-only virtual field derived from three other fields?
- How to create a gallery custom field for WordPress post?
- How to display image inside container of custom made widget
- Custom Metabox additional item
- How to add new field to the account address?
- Split the_title
- Sort WP_Query with numeric custom field
- Display Multiple Values of Same Key
- How to Wrote Simple Calculations by Using Custom Fields in Loop?
- How can I use custom properties to set different background on different pages?
- change order of images attached to post
- theme customizer – can a single option pass multiple values?
- How do I save Multiple fields in a meta box?
- Can I access Posts of custom-fields via URL?
- Output custom field value
- Custom field image to Featured Image
- Change Post Meta via AJAX from the posts list table
- Best way to achieve multiple links in a post title
- plugin-list-category-post custom fields
- How to display data from custom fields I created?
- Get array of posts based on custom field values
- How to automatically change a posts status to draft based on custom field
- How to show ACF fields in Gridbuilder custom block
- search based on custom field
- Why isn’t update_post_meta saving?
- Display taxonomy loop using custom field data
- Adding more fields to the registration form
- use mysql to replace one custom field value with another custom field value
- Change blog post title on main blog page
- Spit out list of distinct instances of custom field?
- tinymce modal and I18n strings methods
- Filter and display a specific custom field value [closed]
- Is it possible in WordPress
- Edit different parts of a page seperately
- I want my post to republish again after adding a custom field
- Custom fields: dropdown values depending on other custom field value
- Custom fields / meta box output
- Creating an If/Else statement using WPAlchemy MetaBox radio boxs
- How to retrive Custom Fields as Values for a Form field
- Media Custom Fields – get a value with PHP
- jaredatch metaboxes on video post formats