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 delete attachments associated with custom field type when post property changes? [closed]
- How to repeate custom field group with bulk image field
- Load one page with parent and child pages
- Output Custom Field value to shortcode
- Update custom table on metabox POST
- Why can’t I get the correct post permalink
- Get link picker custom field to show only if field exists
- PHP and Shortcode Combination
- Use a different catalog image than the featured image
- Sub Field of File Field
- ACF – Compare user and post data
- Login Api with Meta_key and Meta_value
- ACF plugin and field update
- Advanced Custom Fields deleting some code and adding code for a slider
- Save input form on custom field
- Retrieving and inserting data in custom fields
- How to add custom fields to images for image source text and URL
- Counting number of images from loop
- Page template is missing fields or is invalid when I updating the template
- User custom meta delete by serialised key value
- Metabox value for post loop?
- Adding fields to attachment – only shows when inserting new attachments
- Order categories by sum of custom fields
- how to modify a field’s size in a metabox : ROWS height, and scroll control?
- Saved Post Meta Array Returns as String
- How to add content with a filter when there’s no content in the editor
- Login_form add to top of form rather then bottom
- meta_query ‘compare’ => ‘!=’ not working
- Advanced Custom Fields from Category – IF statement
- Check for meta data before it is published
- Query Multiple meta
- How to modify VisualComposer’s TinyMCE editor only for a specific shortcode
- If metabox fields has content display content
- I have a form with a custom button ,i want to add the field data to an database when clicking the custom button
- Stop truncation of shortcodes in custom text fields?
- Delete custom meta
- custom field images do not display until page save
- How to check custom fields from functions.php
- Save custom post data outside of default post form
- display custom media folders to wordpress media popup
- Should I store arrays in custom fields or create custom tables?
- Get custom field outside wordpress loop on new php page
- Retrieving Advanced Custom Field within Shortcode Function [closed]
- Query Posts based on custom field value
- How to format the various types of custom fields?
- Problem saving meta data
- How to properly get popular Posts by multiple Values
- Admin – Search Events by a custom field
- How to add a default field Name to post Custom Fields
- Get file size from ACF repeater field
- Automatically set the_post_thumbnail to Custom Field Value
- create a custom field that let me include other posts
- Append custom field items to content from plugin
- Redirecting to an external URL
- Check if value exists before saving
- Echo out custom fields in comments
- Using ACF Custom Field value in a URL with do_shortcode() [closed]
- Get meta value when the page is a blog archive
- Saving and using Custom Field in user settings/profile “Checkbox list”
- Why WordPress takes time to make request to save post?
- Text in header as a page – hide from Web crawlers
- Custom Metabox Always shows box and checked
- Show comon custom field results?
- Search one custom field?
- Can’t save meta field value if the title not set
- Create custom query for search?
- Add Image With Changeable Link in Custom Field [closed]
- update_user_meta(): invisible data storage