WP_Customize_Nav_Menus::save_nav_menus_created_posts

Advertisement

Summery Summery

Publish the auto-draft posts that were created for nav menu items.

Syntax Syntax

WP_Customize_Nav_Menus::save_nav_menus_created_posts( WP_Customize_Setting $setting )

Description Description

The post IDs will have been sanitized by already by WP_Customize_Nav_Menu_Items::sanitize_nav_menus_created_posts() to remove any post IDs for which the user cannot publish or for which the post is not an auto-draft.

Parameters Parameters

$setting

(Required) Customizer setting object.

Source Source

File: wp-includes/class-wp-customize-nav-menus.php

	 */
	public function customize_preview_init() {
		add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue_deps' ) );
		add_filter( 'wp_nav_menu_args', array( $this, 'filter_wp_nav_menu_args' ), 1000 );
		add_filter( 'wp_nav_menu', array( $this, 'filter_wp_nav_menu' ), 10, 2 );
		add_filter( 'wp_footer', array( $this, 'export_preview_data' ), 1 );
		add_filter( 'customize_render_partials_response', array( $this, 'export_partial_rendered_nav_menu_instances' ) );
	}

	/**
	 * Make the auto-draft status protected so that it can be queried.
	 *
	 * @since 4.7.0
	 *
	 * @global array $wp_post_statuses List of post statuses.
	 */
	public function make_auto_draft_status_previewable() {
		global $wp_post_statuses;
		$wp_post_statuses['auto-draft']->protected = true;
	}

	/**
	 * Sanitize post IDs for posts created for nav menu items to be published.
	 *
	 * @since 4.7.0
	 *
	 * @param array $value Post IDs.
	 * @return array Post IDs.

Advertisement

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.

Advertisement

Leave a Reply