Extract an embedded video from the content

Embeds are cached in hidden post meta fields with _oembed_* keys. You could retrieve all of meta (with get_post_custom() for example) and try to get info from it. However, from quick look at my test data it seems that duplicates are not uncommon there (might have to do with either WP version changes or embed … Read more

WordPress Multisite new sites in directory

Is it possible to make a wordpress multisite on domain.com and then every site that I make goes to domain.com/directory/newsite? no, this is not possible without some major code hacking as far as I can tell. I run a few multisites, and I have some local installations to play around and didn’t manage to find … Read more

How to make author box like this & add after every post?

I’ve not tested your code; but assuming it’s correct and working well, edit your single.php file and insert this code just after the point where you end your post content and before the Comment Section starts. I’d suggest to write this Author Box code in a separate file and then use get_template_part to insert the … Read more

Bulk edit contents of pages

For any other readers I’d like to add in advance that this only really makes sense if you are kind of creating drafts or templates or whatever you want to call it that will be changed later on. Otherwise you’ll at least deal with SEO penalties due to duplicate content. Unfortunately this functionality isn’t part … Read more

How to stop images from being wrapped in tags?

this is a function, that unwraps images from p tags inside the_content /** * WP: Unwrap images from <p> tag * @param $content * @return mixed */ function so226099_filter_p_tags_on_images( $content ) { $content = preg_replace(‘/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s’, ‘\1’, $content); return $content; } add_filter(‘the_content’, ‘so226099_filter_p_tags_on_images’);