Since any attribute added to <br>
tag, including class names and data-attr
s keeps them from stripping, quick and incomplete way could be:
function filter_function_name( $content, $post_id ) {
$content = str_replace('<br>', '<br data-x>', $content);
$content = str_replace('<br >', '<br data-x>', $content);
$content = str_replace('<br />', '<br data-x>', $content);
$content = str_replace('<br/>', '<br data-x>', $content);
return $content;
}
add_filter( 'content_edit_pre', 'filter_function_name', 10, 2 );
Related Posts:
- remove custom post type permalink
- How to change “Draft” string for status of custom post type to “Unavailable”?
- How to correctly get post type in a the_title filter
- Make the ‘all’ filter default instead of ‘mine’ in a custom post type
- Remove “Get Shortlink” button in admin of custom post type
- How to get Custom Post ID by adding filter to child theme’s function
- Add html to cpt main page / admin edit.php
- register_taxonomy and register_post_type does not work [closed]
- Displaying custom taxonomy in the admin list of a custom post type
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Filter Posts from the Main Query
- Create new custom post and post category of same name
- Post Click Redirect to Custom URL instead of Single Post Page
- Filter wp_dropdown_categories Per Post Type
- Custom post type suppress transition from future to publish
- How can I made custom taxonomies relationship?
- WooCommerce sort products by the actual product width(not the shipping width)
- How to change the post type a theme shows by default?
- filter custom post in rest api with custom function
- Filter hierarchical custom post type admin page by parent, and include children & grandchildren
- Sort and filter custom post type posts by custom taxonomy
- Versioned Custom Post Type (Not the same as revisions)
- Loop filtering Custom Post Types and/or Categories
- search suggest – filter post type
- the_content filter on some post types only not working
- Filtering posts list table
- Custom filter function not working with Custom post type
- Categories filtering in new post
- How to use manage_$post_type_posts_columns with underscore in post type?
- How does the filter post_updated_messages work?
- Search filter triggered & sort by custom post type
- How to order posts of a custom post type by date DESC in dashboard Admin?
- Using preg_replace to filter custom textarea
- How can I add a filter to a particular post format?
- Is there any way to get list of all possible filter hooks for all post types?
- Can I display custom post types in home.php or need page template?
- wordpress remove views from action links in a custom post
- wp_insert_post wrong post type [closed]
- Use remove_meta_box conditionally on custom post type
- Include php on a specific page template
- wp_trash_post action hook with custom post type
- Filter posts by tax (dropdown) and meta value
- How do I amend form data before it is saved for a custom post type
- What do the numbers mean at the end of add_action(‘save_post’)…?
- Running a wordpress action when a custom post type term (taxonomy category) is changed
- How can I remove filters from custom post types?
- sortable columns for multiple custom post types not working
- I need to add a filter to prepend the term ‘National – ‘ to the post title if the post is tagged to multiple states
- How do I add custom HTML to the content of an archive page’s posts?
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- REST filters only firing when I have a param set
- Problem with Apply Filters on URL in meta box filed of custom port type
- how to retain the ability to modify the post slug after applying a post_type_link filter?
- How do I show a link or ‘Read More’ button on a custom field excerpt when it is less than the word limit
- How to filter url on post submission?
- Modifying WP_Title For Custom Post Type
- Types plugin custom post add_action hooks
- Filtering the_content, but still need to display the unfiltered content inside filter
- Loading plugin text domain before registering post type
- Change Custom Post Type singular_name through function/filter
- How can I get some of a posts meta data whilst it is still inserting?
- add_action ‘init’ from inside a class for custom post types
- Modify a plugin function output from another plugin
- Custom Taxonomy Filter Issues
- Catch and display error on save_post action
- show most viewed posts of last days by link?
- Filter search posts by post meta?
- Modifying search results based on post_type
- Remove filter and view options from custom post type edit screen
- How to recover the post ID earlier in the WP admin hook action “firing” sequence?
- Is possible register two archive pages for single custom post type?
- Display custom post front end filter by ACF equals current user
- conditional filter
- custom filtering admin columns
- Ajax Post Filter | Split Taxonomy Into minPrice & maxPrice
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Query filter by value in meta_value array
- Using `set_transient()` when saving a custom post type
- Using publish_{custom-post-type} hook for custom post type to update meta doesn’t work
- Best way to fix bad count on All | Mine | Published
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- Is there any filter to add a custom attribute to the tag in admin panel?
- Display category filters for custom post type when category is shared by multiple post types
- Store a value in global scope after init hook is fired
- Filter in Custom post type to find the parent post
- Dynamic page for nav items used as filters
- Create Post Types from a XML url (Real Estate website)
- Filter posts by their related field’s custom field
- How can I add image sizes for a specific custom post type?
- publish_post action callback not executed, why?
- Add content to wordpress edit.php page
- How to use multiple orderby conditions on query search results? (orderby one post type, relevance)
- add_rewrite_tag broke permalinks that doesn’t use that specific tag
- pricefilter without WooCommerce
- Output all terms slugs for a loop filter
- Insert custom taxonomy into category query
- How to store additional data that is related to core data
- filter rest api post by a acf filed
- Group Custom Posts Types in a Relation field of ACF
- Help Adding filter to Add Media button for custom post type