The root of the problem is that isset
expects a variable to be passed to it. Also, I’m assuming that you expect the get_post_meta()
to return a scalar value and not an array, so I added the third parameter set to true.
// 3rd param: $single. Value of true means get scalar value, not an array.
$ytlink = get_post_meta( get_the_ID(), 'songbook_video_link', true );
// Will ensure that $ytlink is boolean false, and not an empty string.
$ytlink = ( ! empty( $ytlink ) ) ? $ytlink : false;
Related Posts:
- Custom Plugin activation error in Multisite
- Post meta vs separate database tables
- How to redirect to settings page once the plugin is activated?
- No Error Log File, no debug info
- How to output message during plugin activation
- Prevent network activation of plugin
- How should one implement add_settings_error on custom menu pages?
- Inserting Taxonomy Terms During a Plugin Activation?
- Prevent notice and warnings in error_reporting?
- How to log plugin errors to plugin error_log file
- Using wp_cron with custom time interval and the register activation hook
- Catch own Exceptions
- Save metabox with multiple checkbox array
- Throw 403 in a plugin [duplicate]
- Call activation hook multiple times
- why don’t I get error messages in admin when developing?
- WP_Error handles errors, but how can I show success with a message?
- How to enable users to down-vote in this simple voting counter (that uses the post meta)?
- Settings API – Undefined Index when unchecking checkbox
- Only allow plugin to be activated on root site of multisite
- why creating tables using $wpdb is not being executed while installing plugins?
- Force plugin to fail activation
- Override pluggable functions in a plugin?
- Plugin activation error due to unexpected output
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- How can I free up the memory used by update_post_meta?
- Is there a way to list tags order by post_meta field
- How can I display an error message after post has been saved?
- Execution limit and Memory limit errors even i changed to 1024M and 600(cache.php,load.php)?
- Plugin development: get_post_meta is not working [closed]
- Ordering posts by metadata
- Settings not set after calling register_setting()
- Act on user meta updated, but only once
- How to check if Woocommerce Order number equals to post ID?
- Proper way to pass credentials in a custom login form to avoid “headers already sent”
- Two functions utilizing registration_errors filter
- How can I gracefully escape an error condition?
- update post meta for checkbox in the admin when inserted in the front-end
- 403 Error when text is pasted in Custom Metabox Textarea
- Insert terms for custom taxonomy on plugin activation, or each page load (init hook)
- Saving value of a selection option in comment form as comment meta
- Add a Save Button to Custom Meta Box [duplicate]
- Plugin with action ‘save_post’ needs to press publish twice on order to publish
- Doubts about the use of metadata and how this can affect performance on WordPress
- update_post_meta not working in a loop
- Run Shortcode of post’s custom field in functions.php / Plugin
- Get draggable widgets on Edit Post page
- Add Link Category on Activation?
- WordPress Plugin Activate / Deactive Failing
- WordPress debug messages not displaying
- WP nonce field checkbox prints checked=’checked’ outside input field
- Multiple array for post_content on plugin activation
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Class cannot be found, but it’s available in the file, I get: Fatal Error: Uncaught Error: Class ‘Blocks\Base\Activation’ not found
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- Custom Post Type Object – Undefined Variables
- Reporting errors in a shortcode plugin
- Using delete_post_meta for deleting multiple selected options
- Get audio metadata on file upload
- What might be the reason of Couldn’t fetch mysqli_result on another domain?
- How do I debug an error that a plugin is causing?
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- Activate / Deactivate plugin
- Any way to update_post_meta with html content? It gets stripped and becomes empty
- Remove Meta-boxes (Yoast SEO plugin) [duplicate]
- Is there a way to add a link with add_post_meta?
- Adjust query on single
- Need Help Determining Where Header Error is Happening
- “Rendering of admin template [path to template] failed”
- Is there any way to pass messages from a script to a redirect target in a hidden fashion?
- Why is $_POST empty when saving custom Meta Box?
- Import images remotly run through timeout error
- Error code when migrate
- WPGut – Updating failed and shortcode?
- Condition to check previous next article post title
- GET request return value as error instead of success
- register_meta not showing custom post type metabox data in rest api
- Insert, update or remove data from database (usermeta)
- WP_Fatal_Error_Handler OR WP_Error OR try/catch
- WordPress Fatal error: Uncaught Error: Call to undefined function dbDelta()
- Unexpected issue when using attachment_fields_to_edit filter
- Warning: Illegal string offset – on homepage
- WordPress delete mysql rows with string
- How to store in the database directly the translation?
- Not able to Update database while creating a custom module
- Saving post meta
- Displaying Custom Post Meta
- Unable to show a message after plugin activation
- Refresh or redirect page after activate my plugin
- I can install my plugin in localhost but not in my server
- Plugin error on activation – breaks page encoding and prints the code of plugin php files
- Include add_post_meta in a plugin
- WordPress plugin tables become corrupt
- Getting error of unexpected output during activation
- Deactivate plugin on registration
- Trying to build a plugin – Cannot modify header information
- how can a plugin return an error message on activation?
- Is there a canonical way for a plugin to install a mu-plugin or drop-in?
- A better way of getting draft posts that has a particular post meta using get_posts function
- My activator class isn’t running the code inside