wpseek.com
A WordPress-centric search engine for devs and theme authors



_wp_in_front_end_context › WordPress Function

Since6.1.0
Deprecatedn/a
_wp_in_front_end_context ( No parameters )
Access:
  • private
Returns:
  • (bool) True if in the front end content context, false otherwise.
Defined at:
Codex:

Check if execution is currently in the front end content context, outside of <head>.



Source

function _wp_in_front_end_context() {
	global $wp_query;

	// Check if this request is generally outside (or before) any frontend context.
	if ( ! isset( $wp_query ) || defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || is_feed() ) {
		return false;
	}

	// Check if we're anywhere before the 'wp_head' action has completed.
	return did_action( 'template_redirect' ) && ! doing_action( 'wp_head' );
}