How to check if page has status published olatechproMarch 29, 20233 Views How to check if page id(SomeID) is actually published? Post Views: 3 Related postsGet rid of this Strict Standards warningWooCommerce: get_current_screen not working with multi languageCan’t login on WordPressForce HTTPS using .htaccess – stuck in redirect loopWordPress: Ajax not working to insert, query and result dataHow Can I pass an image file to wp_handle_upload?
You can use 'publish' === get_post_status( $id ), where $id could be the current page ID retrieved via get_the_ID() or any other. Log in to Reply
You can try this: <?php $page_id = 20; // example id of your page $page = get_page( $page_id ); if ($page->post_status == 'publish') { // page is published } ?> Log in to Reply
You must retrieve the page via the function get_page. Look for the post_status field in the returned object! Log in to Reply
You can use
'publish' === get_post_status( $id )
, where$id
could be the current page ID retrieved viaget_the_ID()
or any other.You can try this:
You must retrieve the page via the function get_page.
Look for the
post_status
field in the returned object!