Yes! Hook the ‘default_content’ filter 🙂
Another possibility is to use ‘the_content’ filter to insert the shortcode into all posts of a certain category or some other criteria when they are output instead of saving the shortcode with the content in the DB. I forget if you can append the shortcode here or if you need to explicitly expand it with do_shortcode()
. One way or the other will work. This way you don’t even need to delete the default shortcode in posts where it’s not needed, the code “knows” when it’s needed automatically.
I am working on a site ethnicforever.com please tell how to make url seo friendly in WordPress and also how SEO Yoast can be used for seo purpose.Any suggestion will be very helpful and useful for me please visit the website and recommend me what i should do.Thanks in advance.
Thanks bcworkz! Now how exactly do I find the ‘default_content’ page? Haha, sorry, Im a little new to this all. Its like a whole new language.
Just like there is a Shortcode API, there is also a Plugin API that explains actions and filters. ‘default_content’ and ‘the_content’ are not pages at all, they are “filters”. You “hook” onto these filters to effect change to the default behavior of WP. This is done by creating a function that does something you want done, then calling add_filter()
so that WP knows to call your function at the appropriate time.
To add default content, your callback function would simply return your desired shortcode. The best place to place little customizations like this is either a custom site specific plugin or a child theme. Both of these are easy to create, the specifics can be found in the Codex.