Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Blocks_Reusable::get_screen_from_referer( string $referer )

Determine the screen where a reusable blocks rest query originated

Description Description

The screen name will either be "widgets" or the WP_Post name of a registered WP_Post type.

For any other screen we return false because we don’t care about it.

Top ↑

Parameters Parameters


(string) (Required) Referring URL for the REST request.

Top ↑

Return Return

(string|boolean) Returns the screen name or false if we don't care about the screen.

Top ↑

Source Source

File: libraries/lifterlms-blocks/includes/class-llms-blocks-reusable.php

	private function get_screen_from_referer( $referer ) {

		// Blockified widgets screen.
		$url_path = wp_parse_url( $referer, PHP_URL_PATH );
		if ( $url_path && 'widgets.php' === basename( $url_path ) ) {
			return 'widgets';

		$query_args = array();
		wp_parse_str( wp_parse_url( $referer, PHP_URL_QUERY ), $query_args );

		// Something else.
		if ( empty( $query_args['post'] ) ) {
			return false;

		// Block editor for a WP_Post.
		return get_post_type( $query_args['post'] );


Top ↑

Changelog Changelog

Version Description
2.3.1 Don't pass null to basename().
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.