$post_id = 1;
if ( set_post_type( $post_id, ‘page’ ) ) {
echo “Post #$post_id is now a Page”;
} else {
echo “Impossible to transform this post into a page”;
}

$post_id = 1;
if ( set_post_type( $post_id, ‘post’ ) ) {
echo “Page #$post_id is now a Post”;
} else {
echo “Impossible to transform this post into a page”;
}

Check Current url is post or page

echo get_post_type( get_the_ID()); // chek the current page is post or not

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...