11 July 2020

How to check if page is exists or not in wordpress ?

check if page is exists or not in wordpress.


function pagecheck(){

$pagetitle = 'Sample Pagee';
$page = get_page_by_title( $pagetitle, OBJECT, 'page' );
$pageid = $page->ID;

if($pageid){
//echo "Exist";
}
else
{

echo "not Exist";

}

}
add_action('admin_head','pagecheck');

No comments:

Post a Comment

How to add re-captcha v3 on all Elementor forms using coding?

 Add re-captcha v3 on all Elementor forms using coding add_action('wp_footer',function(){     ?> <script src="https://www...