The best answer I had was to add a   in the function callback html at the end of the section tag. This forced the curser out of section wrapper in the WYSIWIG of WordPress. It’s not the perfect fix but it worked.
function html5_insert_image($html, $id, $caption, $title, $alt, $align, $url) {
$url = wp_get_attachment_url($id);
$html5 = "<section class="js-simple-lightbox">";
$html5 .= "<figure class="cbp-item">";
$html5 .= "<a class="cbp-lightbox" data-title="$title" href="https://wordpress.stackexchange.com/questions/206966/$url">";
$html5 .= "<img class="img-responsive" src="https://wordpress.stackexchange.com/questions/206966/$url" alt="$alt" width="100%" />";
$html5 .="</a>";
$html5 .= "</figure>";
$html5 .= "</section> ";
return $html5;
}
add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );
Related Posts:
- wp-cli post create & media import issues
- Replace image attributes for lazyload plugin (data-src)
- How do I detach images from posts?
- Unattaching images from a post
- How to wrap every image in a post with a div?
- upload featured image from front end using wordpress add media button
- Retrieving and Storing Images Linked from Other Domains on Local Server?
- how to replace embedded “full” sized images within a post with the “large” ones
- Errors when uploading images in WP 3.5
- Remove Featured Image & All Media Uploaded to the Post
- How to allow multiple thumbnail upload for Posts?
- How to get all inline images in post content? [duplicate]
- Inserting Media to WordPress Posts
- Site/Post preview is not working on all social media
- unable to write to the database while uploading images
- Modified core/image rendering not showing in posts – only on pages
- Post images are not displayed in media library
- WordPress Media URLs?
- How would I attach media/images to a post based on a ID stored in a each post’s custom field
- Broken images after importing posts and opening in Gutenberg
- Optimize blog that serves hundred of images and videos
- Images being uploaded via WP Media are not attached even they are used by some CPT posts
- Center crop the feature image
- post and page and custom post type
- Please I want to prefix my WP posts title according to each category
- Schedule image post on download
- Post relationships/nesting
- insert post fails after multiple postings
- delete post hook not being fired when deling in wordpress dashboard admin
- Manual Scheduler For Custom Post Type
- WordPress Delete Users from backend doesn’t work
- Add another feature image box
- Custom Post Type Rewrite URL
- ‘posts’ table should not store the absolute image path
- Dev and prod on the same database- dev version active for IOS
- Is it possible to make a custom post that adds multiple pages?
- Custom Post Types and Broken Permalinks
- The first post appears twice
- How to delete/customize imported demo content from a theme or add my own?
- Loop through taxonomies and loop through their terms (Newbie question)
- My posts page is missing the page title
- Hiding title of selected post without plugins
- Custom post styling per category?
- How to show category image if no featured image is set?
- Customizing URL slugs of Custom Post Type and Taxonomy make posts/pages 404
- Show custom post category for single post
- How to make an image appear as a thumbnail in the blog post?
- Integrate video and iframe in a post type gallery
- How can change header text in post careate/edit form
- Connection dropped due to file size
- Set featured image on creating new post
- Manipulating images inside post content
- How to get meta data from custom category name
- Add Categories To Custom Post
- Unable to delete images in Media Library
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- how to redirect page after delete post inside a post page?
- Permalink base only for posts
- Custom post type – Loop out in random order but same 15 to appear first… still random
- Custom post type template not called
- Difference between modified post and new post
- Displaying dynamic content (blog posts/portfolio) on a static homepage and keep the blog post styles
- How to use Categories of custom post type
- Append a random string to a post permalink
- how to create other sizes of original image in one go wordpress uploads
- Output wp_link_pages as raw url
- single- and archive- templates not being applied to custom post types, not even after flushing permalinks
- How can I alternate styling of images in a post? [closed]
- Creating widget – ask for selecting a post in the admin panel
- Multiple Custom Post Type loop logic
- WordPress search for specific Post Type
- Show Posts By Custom Field
- issue in wordpress auto delete post and redirect to another 1
- Embed image in post from external url
- Static text above category page
- How can you control what a user is allowed to post in the backend?
- wp query custom orderby not custom field
- Custom Post Type doesn’t use single.php or single-{custom_post_type}.php
- Is possible to do this from function.php
- Hook To Get All Posts Deleted
- How to show content of specific item on the same page?
- Embed button for post screen
- How to retrieve custom field values and save again as array
- Meta boxes not saving
- Custom Select Query pagination not working properly
- Custom Single Post Type not referring to single-post-type.php File
- Stop images from being displayed on the front-end of the site
- Custom URL Structure for posts with subcategories
- Help with a function that will place a map pin for all posts
- How to list all names and descriptions of a custom taxonomy
- Update all images url imported from HTML pages
- Disable Media uploader to users
- Is there a Standard Format for Clean URLs for Archives of Custom Posts?
- How can I have the posts from one word press blog show on the presentation page of another word press site
- Customize search results to include custom posts and display in a specific template page
- Custom permalink based on custom post type fields
- How to get only current images of a post
- Relative Image Urls in Posts are starting from root – Not from WordPress Address (URL) at General Settings
- How to associate media with a post?
- How to modify specific parts of a post content in WordPress