WP_Customize_Manager::has_published_pages()

Return whether there are published pages.

Description

Used as active callback for static front page section and controls.

Return

(bool) Whether there are published (or to be published) pages.

Source

File: wp-includes/class-wp-customize-manager.php

public function has_published_pages() {

		$setting = $this->get_setting( 'nav_menus_created_posts' );
		if ( $setting ) {
			foreach ( $setting->value() as $post_id ) {
				if ( 'page' === get_post_type( $post_id ) ) {
					return true;
				}
			}
		}
		return 0 !== count( get_pages() );
	}

Changelog

Version Description
4.7.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_manager/has_published_pages