I think, you’re mistaken in how if
works…?
$post_meta = get_post_meta(
$GLOBALS['wp_query']->post->ID,
'TourURL',
true
);
if (! empty($post_meta)) echo '<p>Show Link</p>';
else echo '<p>No Link</p>';
This should do what you want – if I understood you correctly.
// UPDATED
Related Posts:
- Most efficient way to add javascript file to specific post and/or pages?
- Display all values of custom a field created with ACF on a page
- How to automatically apply woocommerce product title to all product images alt tags?
- If Custom Field is empty don’t display div
- How to make an meta_query optional?
- How to loop over custom fields in a page template?
- Add custom field to attachments in a specific category
- display most popular tags in two columns
- How can update custom meta for all posts
- Unique key for each row in a repeater field
- get_post_custom single array
- Make custom field meta not display if there is not data in it
- sidebar isn’t showing, what’s wrong w/ this code?
- how to increase custom post value by one most efficiently?
- WordPress widget/sidebar dividers?
- How to show a dynamic_sidebar if main content content’s height is > a set amount?
- How to create a linked tag list in my sidebar
- Passing the custom field values in the wp_get_current_user array function
- Custom profile field with birthday. Troubles with
- WordPress – Display array data of a child
- wordpress allow user to edit user profile with custom fields
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Adding number to date not working [closed]
- Saving and Restoring a Canvas on A Individual User Basis
- Child page menu in sidebar
- auto-populating custom nav with all items from custom post type
- Automatic Shortcode Creation with Custom Fields [closed]
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- Custom Field IF/ELSE PHP
- How to combine 2 php functions into one function with a custom field
- Advanced Custom Fields – display label and value only if value entered
- How to determine if the sidebar is empty? Or not active?
- Saving zero in meta box
- How to check if a PHP string is different than meta field?
- Why does this update_post_meta function not delete the custom field itself?
- Run str_replace on title and save the output to a custom field
- Styling the second sidebar
- Only show image from custom field when present
- Hide Heading if ACF Field is empty
- Custom meta box values are not getting saved for my custom post type
- WP_Query: getting posts where custom field exists
- Creating an image from a custom field
- User Meta Value not echoing despite Var_Dump Showing correct string
- WordPress loop by meta key that is an array? and how loop multiple arrays
- WP All Import / Update stock quantity from multiple XML files
- Concatenate Custom Field Value & HTML Value
- `update_post_meta` not working anymore
- Unable to render custom field after attempt to generate a list of recent post in page template
- Define category ID using get_post_meta
- Hide a div when a custom field is empty
- Comparing Dates from custom field
- Conditional On custom field plugin metabox
- Adding custom url to readmore link using get_permalink()
- Filter unique custom field value based on custom taxonomy category or other custom field
- Add “alt” Attribute to GD Star Rating Tags
- Display background color or image with custom meta box?
- custom header text
- Stuck with sidebar registering
- Using a string from a custom field within a link
- Can ‘Custom Field’ data be inserted into this Short Code?
- Query pulling a single post per month
- Add custom fields from different posts
- Delete images from media library when user deletes an image from ACF Gallery
- Adding a custom meta field with default NULL value which is not selectable
- Order category posts by last word of custom field
- Products listing check if meta checkbox is checked
- How to update custom fields when post is published?
- Block error message in foreach loop when looping through ACF field
- Hide a div if the fiels is empty
- Loading Widgets Via Child Theme
- Inserting a class on before_widget if checkbox is checked
- Where does php code to load data go?
- What is the correct way to search 3 custom fields only in WordPress?
- wp_get_nav_menu_items() with ACF
- How do I get the value of a current user’s custom field?
- How to display custom field from a gallery thumbnail?
- How to use something like meta_query but for fields?
- Getting a value from a custom field from a page that shares a parent with the current page
- Custom fields changes the formatting of metabox input
- Display Content Based on Custom Field Value
- how to run a php code in widget?
- If custom field doesn’t exist, or exists and it’s true show title?
- Custom field in title
- How can I put a custom field as the link of a button shortcode?
- My custom widget won’t stay in the widget area after I refresh the widget page
- Outputting a custom field in PHP
- Sorting Meta Fields?
- Custom fields randomly stop working
- Where can I find the code for the menu page meta boxes?
- How to echo a different field if another field is empty?
- PHP Puzzle: Unique Styles with PHP loop
- I want Page titles and excerpts to show up on home.php in certain order
- Metadata on the WP_Post object
- Appending an ACF custom field to the page title
- Grabbing value of input field inside of array
- Convert custom field date format to “WordPress default”
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress
- How do I organize posts based on their taxonomy?
- How to execute a shortcode within a custom field?