wp_script_is example

$input->set_attribute( 'value', get_search_query() );
        $input->set_attribute( 'placeholder', $attributes['placeholder'] );

        $is_expandable_searchfield = 'button-only' === $button_position && 'expand-searchfield' === $button_behavior;
        if ( $is_expandable_searchfield ) {
            $input->set_attribute( 'aria-hidden', 'true' );
            $input->set_attribute( 'tabindex', '-1' );
        }

        // If the script already exists, there is no point in removing it from viewScript.         $view_js_file = 'wp-block-search-view';
        if ( ! wp_script_is( $view_js_file ) ) {
            $script_handles = $block->block_type->view_script_handles;

            // If the script is not needed, and it is still in the `view_script_handles`, remove it.             if ( ! $is_expandable_searchfield && in_array( $view_js_file$script_handles, true ) ) {
                $block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file ) );
            }
            // If the script is needed, but it was previously removed, add it again.             if ( $is_expandable_searchfield && ! in_array( $view_js_file$script_handles, true ) ) {
                $block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file ) );
            }
        }
    }
$script = 'window._wpLoadBlockEditor.then( function() { wp.data.dispatch( \'core/edit-post\' ).setAvailableMetaBoxesPerLocation( ' . wp_json_encode( $meta_boxes_per_location ) . ' ); } );';

    wp_add_inline_script( 'wp-edit-post', $script );

    /* * When `wp-edit-post` is output in the `<head>`, the inline script needs to be manually printed. * Otherwise, meta boxes will not display because inline scripts for `wp-edit-post` * will not be printed again after this point. */
    if ( wp_script_is( 'wp-edit-post', 'done' ) ) {
        printf( "<script type='text/javascript'>\n%s\n</script>\n", trim( $script ) );
    }

    /* * If the 'postcustom' meta box is enabled, then we need to perform * some extra initialization on it. */
    $enable_custom_fields = (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true );

    if ( $enable_custom_fields ) {
        $script = "( function( $ ) { if ( $('#postcustom').length ) { $( '#the-list' ).wpList( { addBefore: function( s ) { s.data += '&post_id=

function wp_localize_jquery_ui_datepicker() {
    global $wp_locale;

    if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) ) {
        return;
    }

    // Convert the PHP date format into jQuery UI's format.     $datepicker_date_format = str_replace(
        array(
            'd',
            'j',
            'l',
            'z', // Day.             'F',
            

function render_block_core_file( $attributes$content$block ) {
    $should_load_view_script = ! empty( $attributes['displayPreview'] );
    $view_js_file            = 'wp-block-file-view';
    // If the script already exists, there is no point in removing it from viewScript.     if ( ! wp_script_is( $view_js_file ) ) {
        $script_handles = $block->block_type->view_script_handles;

        // If the script is not needed, and it is still in the `view_script_handles`, remove it.         if ( ! $should_load_view_script && in_array( $view_js_file$script_handles, true ) ) {
            $block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file ) );
        }
        // If the script is needed, but it was previously removed, add it again.         if ( $should_load_view_script && ! in_array( $view_js_file$script_handles, true ) ) {
            $block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file ) );
        }
    }

    

        }
    }

    if ( $is_list_open ) {
        $inner_blocks_html .= '</ul>';
    }

    // If the script already exists, there is no point in removing it from viewScript.     $should_load_view_script = ( $is_responsive_menu || ( $has_submenus && ( $attributes['openSubmenusOnClick'] || $attributes['showSubmenuIcon'] ) ) );
    $view_js_file            = 'wp-block-navigation-view';
    if ( ! wp_script_is( $view_js_file ) ) {
        $script_handles = $block->block_type->view_script_handles;

        // If the script is not needed, and it is still in the `view_script_handles`, remove it.         if ( ! $should_load_view_script && in_array( $view_js_file$script_handles, true ) ) {
            $block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file, 'wp-block-navigation-view-2' ) );
        }
        // If the script is needed, but it was previously removed, add it again.         if ( $should_load_view_script && ! in_array( $view_js_file$script_handles, true ) ) {
            $block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file, 'wp-block-navigation-view-2' ) );
        }
    }

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