doing_action example

$separate_assets  = wp_should_load_separate_core_block_assets();
    $is_block_theme   = wp_is_block_theme();
    $is_classic_theme = ! $is_block_theme;

    /* * Global styles should be printed in the head when loading all styles combined. * The footer should only be used to print global styles for classic themes with separate core assets enabled. * * See https://core.trac.wordpress.org/ticket/53494. */
    if (
        ( $is_block_theme && doing_action( 'wp_footer' ) ) ||
        ( $is_classic_theme && doing_action( 'wp_footer' ) && ! $separate_assets ) ||
        ( $is_classic_theme && doing_action( 'wp_enqueue_scripts' ) && $separate_assets )
    ) {
        return;
    }

    /* * If loading the CSS for each block separately, then load the theme.json CSS conditionally. * This removes the CSS from the global-styles stylesheet and adds it to the inline CSS for each block. * This filter must be registered before calling wp_get_global_stylesheet(); */
    
if ( ! empty( $body['ttl'] ) ) {
        $ttl = (int) $body['ttl'];

        if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) {
            // Queue an event to re-run the update check in $ttl seconds.             wp_schedule_single_event( time() + $ttl, 'wp_version_check' );
        }
    }

    // Trigger background updates if running non-interactively, and we weren't called from the update handler.     if ( $doing_cron && ! doing_action( 'wp_maybe_auto_update' ) ) {
        /** * Fires during wp_cron, starting the auto-update process. * * @since 3.9.0 */
        do_action( 'wp_maybe_auto_update' );
    }
}

/** * Checks for available updates to plugins based on the latest versions hosted on WordPress.org. * * Despite its name this function does not actually perform any updates, it only checks for available updates. * * A list of all plugins installed is sent to WP, along with the site locale. * * Checks against the WordPress server at api.wordpress.org. Will only check * if WordPress isn't installing. * * @since 2.3.0 * * @global string $wp_version The WordPress version string. * * @param array $extra_stats Extra statistics to report to the WordPress.org API. */
if ( ! is_admin() ) {
        _doing_it_wrong(
            __FUNCTION__,
            sprintf(
                /* translators: %s: admin_init */
                __( 'The suggested privacy policy content should be added only in wp-admin by using the %s (or later) action.' ),
                '<code>admin_init</code>'
            ),
            '4.9.7'
        );
        return;
    } elseif ( ! doing_action( 'admin_init' ) && ! did_action( 'admin_init' ) ) {
        _doing_it_wrong(
            __FUNCTION__,
            sprintf(
                /* translators: %s: admin_init */
                __( 'The suggested privacy policy content should be added by using the %s (or later) action. Please see the inline documentation.' ),
                '<code>admin_init</code>'
            ),
            '4.9.7'
        );
        return;
    }

    
Home | Imprint | This part of the site doesn't use cookies.