Add default content to post (for specific category)

default_content runs when a post is loaded into the editor, actually. You can check for categories when the post is saved, but you’d want the save_post hook, probably. You want to check the $_REQUEST global. add_filter( ‘default_content’, ‘my_editor_content’ ); function my_editor_content( $content ) { global $_REQUEST; if (isset($_REQUEST[‘post_category’]) && in_array($some_category_id,$_REQUEST[‘post_category’])) { $content = “My html … Read more

Built-in Method to Extract Embedded Video from Content

It looks like the closest you get is in the WP-Embed class: autoembed( $content ); It says it extracts urls which are on distinct lines (like you’d put a url in for embedding it), but it then passes it to WP_Embed::shortcode(). Not quite what you want. You could dig into WP_Embed::shortcode() to see if you … Read more

Retrieve page content and pass to PHP?

the_content does echo the content. That is stated in the Codex– “Displays the contents of the current post”, emphasis mine. Use get_the_content instead, to return a string that you can manipulate. Be aware that get_the_content does not run all of the same filter as the_content. Again from the Codex: If you use plugins that filter … Read more

Update references to pictures on website after moving to new URL

Besides doing a custom query in your MYSQL database, I’ve found this little script to be helpful in my development process, and I’ve incorporated into my regular workflow to keep my local, development and production servers synchronized: https://github.com/interconnectit/Search-Replace-DB Just be sure to read the documentation, especially about overwriting GUID values and also make sure to … Read more