Connect with us

How to fix the misspelling of WordPress in your post’s content?

solution

How to fix the misspelling of WordPress in your post’s content?

Add the following function into your newly written plugin (or functions.php file of your theme), to correct misspellings of wordpress to WordPress:

 

function thefirst_content_replace( $content ) {
    return str_replace( ‘wordpress’, ‘WordPress’, $text );
}
add_filter( ‘the_content’, ‘thefirst_content_replace’ );

 

thefirst_content_replace is the unique name we’ve given our function. When adding new functions never start them with wp_ – this to prevent any future incompatibilities with WordPress code functions which all use the prefix wp_.

Our PHP function takes ( $text ) as the argument, and returns the 1st string ‘wordpress’ replaced with the 2nd string ‘WordPress’.

We’ve added a filter ( add_filter ) to our plugin to tell our function ( thefirst_content_replace ) to work on the text we’ve selected, which in this case is the entire post content ( the_content ).

Continue Reading
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in solution

    About Me:

    Szabi Kisded

    Hey there, I'm Szabi. At 30 years old, I quit my IT job and started my own business and became a full time WordPress plugin developer, blogger and stay-at-home dad. Here I'm documenting my journey earning an online (semi)passive income. Read more

    Sign up for my newsletter and get the YouTube Caption Scraper WordPress plugin for free
    (worth 29$)!

    All My Plugins In A Bundle:

    My AutoBlogging Plugins:

    My Online Courses:

    A Theme I Recommend:

    Featured Posts:

    To Top