You can use if else:
<div class="video-embed" style="margin-top: 0px; z-index:102; margin-bottom: 0px;">
<?php
$url1 = get_post_meta( $post->ID , 'video_play' , true ) ?: get_post_meta( $post->ID , 'video_stop' , true ) ?: false;
if( $url1 ):
$search="#(.*?)(?:href="https://wordpress.stackexchange.com/questions/302040/https?://)?(?:www\.)?(?:youtu\.be/"youtube\.com(?:/embed/|/v/|/watch?.*?v=))([\w\-]{10,12}).*#x";
$replace="http://www.youtube.com/embed/$2";
$url = preg_replace($search,$replace,$url1);
?>
<iframe width="560" height="315" src="<?php echo $url; ?>" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<?php
else:
echo "This video is removed";
endif;
?>
</div>
Related Posts:
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Individual Widgets per Page
- Is it safe to store a user setting you don’t want the user to ever modify as a user option?
- Add custom fields to search
- How to add add_meta_box to specific Page Template?
- How to get users by a custom field / by user meta data?
- Auto sort the wp-admin post list by a meta key
- extend Meta Box / Document Panel
- Add multiple images to a page sidebar
- getEntityRecord without knowing the post type
- Add custom field to image editor
- Show User Their Password
- Metabox nonce PHP notice
- TinyMCE in Custom Metabox not loaded after upgrading from WP 3.1.4 to WP 3.2
- How to break meta values into different items and avoid duplicates?
- ajax delete value from custom field array
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Custom field for default gallery
- After moving my site from a dev subdomain, to root, all my custom meta data is gone
- How can I query on the year part of a complete date in a custom field?
- Gravity Forms: Create fields programmatically
- WordPress Custom Field Should be Unique. Is it possible?
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How to display Meta Field Value?
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- What is the cleanest way to extract custom variables from a post
- Add source URL from Feed WordPress (Syndication) plugin to a custom field in post editor
- List custom taxonomy terms from custom field
- How do I create a column in Users list and display user data from custom registration field
- Display only past events on that page using Visual Composer Grid Bulider
- Better Method for Multiple Meta Boxes
- user Profile meta value as custom field
- Remove Body Classes
- Use WPbakery for own custom field [closed]
- Product Custom Fields with HTML and JS
- Add new image block, set default class name and update it using Javascript
- Add image to menu item with ACF
- Client PDF Upload (Catalogue) – Automatically update link to PDF
- Change the sort order for posts to include custom field
- Button inside Custom Meta Box triggering the Update Button
- How to load an assets based on custom field value?
- Adding auto-complete to custom gravity field not working
- Search in Archive Pages by subcategory, tag, custom field and year
- Get image url using image id
- Get categories query not working in function.php
- wordpress custom loop ascending descending posts by custom field
- Hide custom fields when empty
- Only show when content added via custom field
- Using a custom field inside a shortocde
- Add Custom Profile Field as Notes
- How add multiple wp_editor_box to new post
- Increment user meta data by 1 each time a page is visited
- Add custom column for custom field
- ul list with only as many li’s as filled custom fields
- Is there a way to dump all registered sidebar/widget?
- How to hide post meta
- ACF Plugin How to make the customer add more fields in the post?
- custom field in admin columns
- How to sort by custom field value?
- Meta Box Plugin Cloned Fields – Multiple Foreach values
- get_post_meta returns 0
- Custom field bug in WordPress 3.2
- Users uploaded image and matching an id or taxonomy
- Adding data to User profile
- How can I change author of posts to the value of one of the custom field of the posts?
- How to save multiple values with same meta_key, each value linked to another tag id
- Let any visitors delete a post if they know Id nr & password?
- What WordPress “technology” would I use if I wanted subscribers to be able to mark pages with characteristics and notes?
- update a custom field with the value of another existing custom field
- Post meta data not showing in frontend, until hitting ‘update’ button
- open modal window
- a lot of custom fields
- Hide custom fields by user’s role
- Ordering posts by custom fields (Date)
- update meta field value after
- PHP and Shortcode Combination
- If metabox fields has content display content
- Retrieving Advanced Custom Field within Shortcode Function [closed]
- How to properly get popular Posts by multiple Values
- Custom fields and auto save
- Save values generated via API as custom meta fields
- Query Custom Fields in Searchform
- Get custom fields when hover link of post
- WP Query multiple select form – meta_query help
- update_post_meta not working in action hook
- Load code for custom fields only on admin pages?
- Custom field in a shortcode?
- Group pages by custom field values
- Convert many posts from having a specific meta_key to use a post_format
- Exclude empty fields from custom field calculation (Average)
- How to create Parent-Child relation for custom fields?
- How to check if custom field exists in this widget query
- display loop only if a post meta data exist
- How do i output images from URL’s added to the same custom field key
- Add Custom field under the post title [closed]
- Check if a field is capitalized?
- Filter Query Post by Custom Fields(by date)
- Can’t sort custom column on user.php by number / meta_value_num?
- Need to call this php function inside a modal window from text widget