It is not a good practice to override the WordPress native functionality. Instead you can hide the empty elements using CSS
p:empty {
display: none;
}
This will the empty elements.
Related Posts:
- Multi user site and image captions
- Text editor on WP caption [closed]
- Add extra class to wp-caption?
- wp_get_attachment_caption to pull Image Caption or alt
- Showing image description along with embedded links below post images
- Captions for More Fields groups, not just individual fields
- How to add line breaks inside Gallery Captions
- Can’t insert caption into image
- How to get the_post_thumbnail caption?
- Remove wp-caption but still show the image
- Image caption not rendering on some images – Shapely theme
- slider stripping out caption/excerpt line breaks
- How to always add caption element to images – even if empty?
- Get Image Description
- make WordPress image captions responsive
- Featured image shortcode
- Are captions stored anywhere?
- How to wrap WordPress image captions inside H2, H3 tags?
- Remove image caption from post excerpt
- How I can get image description/title/alt for gallery image?
- Is there a way to define a default caption to all uploaded images
- How to add a link in a image’s caption?
- Alter media caption/description conflict in WordPress?
- How to display a shortcode caption somewhere other than the_content
- Caption in Page adding unwanted 10px to width
- How to limit post content and remove image caption from it
- Nested Shortcode Inside [caption] Doesn’t Process
- Update caption for metabox gallery images
- How to show post format gallery metabox image caption in the post front end
- Get image captions for images on gallery post format metabox
- Get post embedded image caption
- Adjust image caption within visal editor
- Drag images with caption in WP editor
- Different captions for the same image in multiple galleries. Edit Image in Gallery locally
- Adding a video description in a similar way to a image caption
- Include captions
- Remove inline width from figure
- How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)
- HTML tags in WordPress image caption
- Automatically add image caption with values from a post parent field?
- PHP code to call image Caption, Alternative Text, and Decription?
- Getting Featured Image Caption to Only Show if Populated
- Caption shortcodes not including caption as attribute
- Add post-thumbnail after first paragraph including the caption
- Gallery IDS and Captions: hide/show on a per ID basis
- Add caption functionality to custom WordPress theme
- echo image caption
- XML-RPC: How to add media caption to uploaded image?
- How to add ‘data-caption’ inside an anchor tag
- Removing height and width from images with a caption
- Include caption underneath post images
- Turn off image captions in gallery view?
- Move Image Captions Inside Link ( tag) if Added
- Can I nest a element within tags from default wordpress?
- How to add custom classes to figure element only if image has caption?
- Replace image caption with its title and description
- Forcing max-width for image captions
- How do I remove featured images and captions from a wordpress RSS feed?
- Omit image captions from get_the_content()
- How to dynamically insert in the image caption?
- Displaying an image’s alt title and caption inside a fancybox window. Working, but showing the same alt and caption for each image
- Displaying caption with featured image
- add_filter img_caption_shortcode not implemented
- Shortcode function doesnt work without caption
- Custom field as featured image caption
- How to add a caption to an image attachment in a file list?
- caption shortcode using image alt as caption
- WordPress Caption Formatting
- WP Gallery showing captions twice
- Custom caption output for custom image size
- Random home page background images with caption text
- How to edit caption for images and exclude it from excerption query?
- Style wordpress image captions in RSS
- How to join Caption AND Description Meta Fields as one combined-caption in Image Block
- Not able to remove caption shortcode from the content
- How to modify image caption in posts?
- how automatically show the image title before the image caption/description in a wordpress gallery?
- How to Display Image Caption but Not Alt Text
- How to auto add image caption from image alt?
- Unknow shortcode read on display site
- Is there a way to create referable automatic numbering in image captions?
- How to hide / remove attachment “alt” or “caption” field in Admin?
- Problem to return more than single line captions
- Displaying “alt” attribute text as captions?
- Add caption to thumbnails in content
- How do I change the woocommerce product gallery to show all thumbnails instead of three at a time in a carousel?
- Automatically Add Caption Shortcode to Image with Caption Field Filled In
- Move captions under gallery images in twenty fourteen theme
- Remove Captions from Custom Gallery function.php
- page displaying media caption shortcodes
- SQL query to remove first image in all posts
- How to change images size after theme modification?
- How to add a credit line to a photo caption
- Move caption in on attachment page
- Wrap a post image with a div if it doesn’t have a caption
- Seeking recommendations on Gallery plugins , specifically captioning thumbnails [closed]
- Check if a field is capitalized?
- How to show image caption in Woocommerce gallery
- How to display featured image caption only if exists?
- Adding caption to all images inside an article