Duplicate posts and change category

There’s plugin to do that – Duplicate Post While viewing a post as a logged in user, you can click on Copy to a new draft as a dropdown link under Edit Post in the admin bar. This will lead you to edit post page, change whatever you want and save. It’ll save it as … Read more

update_options and unique filenames

Welcome to the lions den So you’re willing to get down into the blazing furnace or the lions den and change the upload path. This is so not a good idea without investigating what is happening behind the scenes. I can’t give you a full write up, as there’s so much involved, like filters, options … Read more

Merging two wp_posts tables while avoiding duplicates

Import the new table as wp_posts_2, then join them and delete all duplicates based on post_content; then merge the two tables. The following SQL query (untested!) should give the posts from the new table to be deleted: SELECT wp2.* FROM wp_posts_2 as wp2 LEFT JOIN wp_posts as wp ON wp2.post_content = wp.post_content WHERE wp2.post_content = … Read more

How do I host WordPress on a hidden domain through a reverse proxy?

To ensure your content isn’t crawled from the hidden admin DOMAIN you could include something like this in your .htaccess file. RewriteEngine On #Force traffic to production URL RewriteCond %{HTTP_HOST} !xxxx.com$ [NC] RewriteRule (.*) http://www.xxxx.com/guides/%{REQEUST_URI} [R=301,L] There is more than one way to handle this first redirect so your code may work too (didn’t test … Read more

Performance : Duplicating `add_action`

Well, the short answer is the first item consumes more memory then the second one. One of the reason would be that WordPress hooks uses call_user_func_array() to call al those functions dynamically. And call_user_func_array() actually takes an array as one of its parameter and do a search for a function with this name. So in … Read more

Why are theme templates organized as multiple point of entry PHP files instead of reusing your theme’s index.php?

Theme template files are organized in this way because of the WordPress Template Hierarchy. Since all primary template files eventually fallback to index.php, it is certainly possible to use only the index.php primary template file. There are advantages and disadvantages to using either method. Generally speaking, the usefulness/efficiency of defining template files is inversely proportional … Read more