Hi guys I'm working on this public theme where the previous developer had created a post type called "blog" the problem is that when you create a page with the same slug it creates a conflict.
The theme is being used by several clients and I'm trying to avoid this issue by renaming the post type without having the users/clients to run by any problem.
I'm doing the following:
$theme_executed = false;
if(!$theme_executed) {
theme_blog_news();
$theme_executed = true;
}
function theme_blog_news(){
$theme_sql= mysql_query("UPDATE wp_posts SET post_type = 'news' WHERE post_type = 'blog'");
if (!$theme_sql) {
die('Invalid query: ' . mysql_error());
}
}
It worked but I'm looking for a best practice or a more native way.
Thanks