Notice the if ( is_page()
line. It’s to indicate that the snippet only works with pages, not posts. Pull it out of the if condition if you want to apply it site-wide.
function wpdocs_replace_content( $text_content ) {
$text = array(
'chamber' => '<strong>chamber</strong>',
);
$text_content = str_ireplace( array_keys( $text ), $text, $text_content );
return $text_content;
}
add_filter( 'the_content', 'wpdocs_replace_content' );
Related Posts:
- append PHP function to the_content
- Wrap First Character after in a tag
- How to call function at the bottom of post using plugin?
- Removing “wpautop” (auto tags) only on certain pages?
- Get the_content surrounded by instead of
- How to Create custom block for displaying information in content section which act like shortcode
- How to bind each “the_content” elements to a custom variables
- How to make a image-size selected by default in Media upload – WP v3.5
- Apply class to every paragraph that holds image?
- Remove “Insert from URL” link in Media upload – WP 3.5
- static variable loop not working in WordPress
- How can i remove all html tags from get_the_content()?
- How to change the wp-login.php page title?
- adding a filter to a shortcode?
- Hide custom image sizes from media library
- Set media upload attachment link to none and hide it in WP v3.5
- How to set custom cookies before output
- Permanently remove first image from posts
- Change the footer text on the login page
- How can I hook into and edit the text of a wp_nav_menu tag?
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- add_filter to post-gallery and remove all ‘s?
- Rename image uploads with width in filename
- How to make an meta_query optional?
- How to overwrite youtube embed?
- Rewriting search and pagination base
- Check if page parent has certain template
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- Change comments form title on a page by page basis
- Filter the blog title displayed in the header
- Display only text to WordPress loop without loosing the text formatting
- Remove class that has been added by parent theme
- Changing the HTML Of the content
- “Maximum function nesting level of ‘100’ reached” after adding a new filter
- How do I know what variables are passed in a filter/action and what their meaning is?
- Find variables available at a given hook
- wp_get_attachment_url filter won’t accept two arguments
- body_class filter – Is there a better way to write this code?
- Why do filters/actions require an argument count?
- How to add Shortcode (font awesome) in widget title?
- Filter link to existing content suggestion
- WordPress Wysiwyg Content not being displayed
- Go to / Scroll to Password Field on WordPress Posts After Submit With Message(s)
- Extremely slow pageload for long post when using the_content?
- Getting my head round WordPress filter
- How To Change The Html of Products filtration sidebar in Woocommerce?
- Woocommerce filter cart and category specific quantity [closed]
- How to set a custom path, for ajax image upload folder in admin?
- Filter get_the_title to remove certain characters?
- Output 2 items within the Loop
- Get posts with at least one category in common with current post?
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- How to use return in my custom function instead of echo
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- WordPress php filter admin_body_class not working
- Problem adding class to body_class
- Run a filter when a walker runs
- Combine two filters into a single call
- Remove a filter added by a plugin
- Change the site tagline (or similar) based on current page
- Handling Body class based on Template
- Get_avatar filter?
- WooCommerce Related Products by Attribute
- Custom filter in admin edit custom post type responding with invalid post type?
- Add a class to the anchor tag on HTML5 gallery
- Nesting if statements to echo only one string based on what tag was filtered?
- How to properly loop through these external URLs to get them into the sitemap using this hook
- Input type search in Menu
- Output Buffering – Everything between wp_head and wp_print_footer_scripts?
- How do I Add HTML to the_excerpt() & the_content() Output?
- add_action shortcut?
- Showing content from one page on another
- Is it acceptable to treat a filter like an action?
- How can I remove a function that has been added to wordpress with add_filter?
- How to control WordPress image metadata (using Imagick)?
- Edit incorrect password message WordPress
- 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?
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Add filter when image is uploaded?
- Remove the first 5 characters of the_title and orderby that
- Remove a div from RSS feed
- Print last modified date only on posts
- 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?
- Unique icons next to each WordPress menu item
- Change tinyMCE editor to allow marked content when pasting from Word
- Problem with login form
- Get URL from shortcode tag
- Alter required message using comment form api
- Hide Featured Image Meta Box on Editor Screen
- Getting content from a referenced post
- Add item to top of menu using a filter in functions.php
- Only first shortcode gets executed
- Add filter multiple times using only one master function