You can use the_content_feed
hook for that. It is used to filter the content of the post after it is retrieved from the database and filtered by “the_content” and before it is sent to RSS reader (or browser).
So here’s the code:
add_filter( 'the_content_feed', function ( $content ) {
$content = str_replace( '<div class="well"> <a class="btn" href="https://wordpress.stackexchange.com/questions/330141/foo.com">foo</a></div>', '', $content );
return $content;
} );
Related Posts:
- Change the footer text on the login page
- How can I hook into and edit the text of a wp_nav_menu tag?
- Check if page parent has certain template
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- Find variables available at a given hook
- Getting my head round WordPress filter
- How To Change The Html of Products filtration sidebar in Woocommerce?
- How to set a custom path, for ajax image upload folder in admin?
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- How to call function at the bottom of post using plugin?
- Handling Body class based on Template
- Editing Category RSS Feeds
- Edit incorrect password message WordPress
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- How to add an arrow to menu items has submenus
- WordPress Gravatar filter is removing my custom attributes
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Can I add the post featured image to a specific RSS feed?
- How to have different site identity logos on each page on Astra Theme [closed]
- Must filter functions receive all arguments passed to them?
- Aspx/Rss feed – failed to open stream: Redirection limit reached
- How to sort WooCommerce products page by latest in-stock items first?
- Filter wordpress posts without searching the keywords in the post content
- Variation prices breakdown only for single product page
- WordPress create custom XML RSS feed template
- How to edit post meta data before publishing the post it self wordpress?
- Fatal error: Uncaught Error: Class ‘WP_Block_Styles_Registry’
- using filter and hook inside class
- add_filter() inside another add_filter()
- Add class to all meta boxes for a custom post type
- A custom RSS feed link, how do I modify the XML structure?
- How to add custom checkout field in user details mail template
- For each loop will not append to the_content hook
- Assign new post author IF another user in custom field on post transition
- Replace category titles inside RSS feed
- Is there a hook that I can use when a fatal error occurs?
- how to append ACF field data using one of the following filter/ hooks
- How can I remove a function that has been added to wordpress with add_filter?
- Sending data from custom inputs in WordPress comment form in the admin notification email
- How to control WordPress image metadata (using Imagick)?
- How do I add custom bulk actions to multiple custom post types?
- Add data attribute to each li in menu
- Show prices with tax in Woocommerce Mini Cart [closed]
- Ajax category filtering products default show all
- Add a specific part of current category page url to shortcode
- Why does my callback function not work with this custom filter hook?
- Reload part of checkout on changed shipping method
- Trying to build simple deposit code that hooks into woocommerce
- Removing “wpautop” (auto tags) only on certain pages?
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Remove metabox from WordPress menu editor page?
- Add a product to checkout via form
- Add filter when image is uploaded?
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- Why ajax doesn’t work on certain wordpress hooks?
- Remove the first 5 characters of the_title and orderby that
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- Print last modified date only on posts
- user_profile_update_errors hook not executing
- Set meta field to publish date + 2 weeks
- Error in custom php function doesn’t exist
- Don’t insert if permalink is the same?
- Return a numerical function value in Customizer controls
- Adding widgets to my plugin page instead of WordPress dashboard
- Unique icons next to each WordPress menu item
- edit_comment_link is not showing for comment author
- Adding function to Genesis genesis_header [closed]
- Modify custom field input data before creating a new post
- how to make custom ajax handler?
- Are all hooks/functions tied to Kses meant for sanitization?
- get post content of particular post by url
- Change tinyMCE editor to allow marked content when pasting from Word
- Display image from an external rss feed on wordpress without plugins
- Problem with login form
- Alter required message using comment form api
- How to debug this search & replace strings snippet?
- Why does wp_head hook my functions to the beginning of my source code?
- Pass argument to event hook
- Hide Featured Image Meta Box on Editor Screen
- Add item to top of menu using a filter in functions.php
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- Should `wp_login` be used since it’s deprecated?
- Add filter multiple times using only one master function
- How to edit php code in WordPress Post file?
- Change page title from page using php via php executed from page/post itself
- How to make modifications only to certain elements of an HTML string on the server-side?
- Override a function defined in wp-includes/comment-template.php
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- Password minimum length in personal subscription [closed]
- How to use a custom hook
- Run a code only on theme activation only during first activation
- Theme activation hook in php class
- Filtering a function’ output for a new continued function
- Deleting Certain terms from appearing on the front end as links
- How to modify the default feed via a function
- Theme not calling Jquery properly
- Content filter won’t work
- Change custom post type GUID in RSS
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?