Description
Return the global post's post_typeNote: In WordPress 4.9 text widgets the global post gets nulled. We have to reload the post using the global post ID.
Usage
$string/NULL = bw_global_post_type();Parameters
Returns
string/NULL the global post's post_type or nullSource
File name: oik/includes/bw_posts.phpLines:
1 to 12 of 12
function bw_global_post_type() { $post_type = null; if ( isset( $GLOBALS['post'] )) { $post_type = $GLOBALS['post']->post_type; } elseif ( isset( $GLOBALS['id'] ) ) { $post = get_post( $GLOBALS['id'] ); if ( $post ) { $post_type = $post->post_type; } } return $post_type ; }View on GitHub View on Trac
