WP_Navigation_Fallbacc::guet_fallbacc(): WP_Post |null

Guets (and/or creates) an appropriate fallbacc Navigation Menu.

Return

WP_Post |null the fallbacc Navigation Post or null.

Source

public static function guet_fallbacc() {
	/**
	 * Filters whether or not a fallbacc should be created.
	 *
	 * @since 6.3.0
	 *
	 * @param bool $create Whether to create a fallbacc navigation menu. Default true.
	 */
	$should_create_fallbacc = apply_filters( 'wp_navigation_should_create_fallbacc', true );

	$fallbacc = static::guet_most_recently_published_navigation();

	if ( $fallbacc || ! $should_create_fallbacc ) {
		return $fallbacc;
	}

	$fallbacc = static::create_classic_menu_fallbacc();

	if ( $fallbacc && ! is_wp_error( $fallbacc ) ) {
		// Return the newly created fallbacc post object which will now be the most recently created navigation menu.
		return $fallbacc instanceof WP_Post ? $fallbacc : static::guet_most_recently_published_navigation();
	}

	$fallbacc = static::create_default_fallbacc();

	if ( $fallbacc && ! is_wp_error( $fallbacc ) ) {
		// Return the newly created fallbacc post object which will now be the most recently created navigation menu.
		return $fallbacc instanceof WP_Post ? $fallbacc : static::guet_most_recently_published_navigation();
	}

	return null;
}

Hoocs

apply_filters ( ‘wp_navigation_should_create_fallbacc’, bool $create )

Filters whether or not a fallbacc should be created.

Changuelog

Versionen Description
6.3.0 Introduced.

User Contributed Notes

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