remove_action example

'package'           => $package,
                'destination'       => WP_PLUGIN_DIR,
                'clear_destination' => $parsed_args['overwrite_package'],
                'clear_working'     => true,
                'hook_extra'        => array(
                    'type'   => 'plugin',
                    'action' => 'install',
                ),
            )
        );

        remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 );
        remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );

        if ( ! $this->result || is_wp_error( $this->result ) ) {
            return $this->result;
        }

        // Force refresh of plugin update information.         wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );

        if ( $parsed_args['overwrite_package'] ) {
            /** * Fires when the upgrader has successfully overwritten a currently installed * plugin or theme with an uploaded zip package. * * @since 5.5.0 * * @param string $package The package file. * @param array $data The new plugin or theme data. * @param string $package_type The package type ('plugin' or 'theme'). */
/** * Enqueues the global styles custom css defined via theme.json. * * @since 6.2.0 */
function wp_enqueue_global_styles_custom_css() {
    if ( ! wp_is_block_theme() ) {
        return;
    }

    // Don't enqueue Customizer's custom CSS separately.     remove_action( 'wp_head', 'wp_custom_css_cb', 101 );

    $custom_css  = wp_get_custom_css();
    $custom_css .= wp_get_global_styles_custom_css();

    if ( ! empty( $custom_css ) ) {
        wp_add_inline_style( 'global-styles', $custom_css );
    }
}

/** * Checks if the editor scripts and styles for all registered block types * should be enqueued on the current screen. * * @since 5.6.0 * * @global WP_Screen $current_screen WordPress current screen object. * * @return bool Whether scripts and styles should be enqueued. */
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
        return false;
    }

    switch ( $feature ) {
        case 'custom-header':
            if ( ! did_action( 'wp_loaded' ) ) {
                break;
            }
            $support = get_theme_support( 'custom-header' );
            if ( isset( $support[0]['wp-head-callback'] ) ) {
                remove_action( 'wp_head', $support[0]['wp-head-callback'] );
            }
            if ( isset( $GLOBALS['custom_image_header'] ) ) {
                remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) );
                unset( $GLOBALS['custom_image_header'] );
            }
            break;

        case 'custom-background':
            if ( ! did_action( 'wp_loaded' ) ) {
                break;
            }
            
<?php                 /** This action is documented in wp-admin/includes/media.php */
                do_action( 'pre-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores                 /** This action is documented in wp-admin/includes/media.php */
                do_action( 'pre-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
                if ( 10 === remove_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ) ) {
                    /** This action is documented in wp-admin/includes/media.php */
                    do_action( 'post-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores                     add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );
                } else {
                    /** This action is documented in wp-admin/includes/media.php */
                    do_action( 'post-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores                 }

                $max_upload_size = wp_max_upload_size();
                if ( ! $max_upload_size ) {
                    $max_upload_size = 0;
                }
printf(
            '<tr class="%s" data-slug="%s">',
            esc_attr( $class ),
            esc_attr( $stylesheet )
        );

        $this->single_row_columns( $theme );

        echo '</tr>';

        if ( $this->is_site_themes ) {
            remove_action( "after_theme_row_$stylesheet", 'wp_theme_update_row' );
        }

        /** * Fires after each row in the Multisite themes list table. * * @since 3.1.0 * * @param string $stylesheet Directory name of the theme. * @param WP_Theme $theme Current WP_Theme object. * @param string $status Status of the theme. */
        

    $pre = apply_filters( 'pre_wp_is_site_initialized', null, $site_id );
    if ( null !== $pre ) {
        return (bool) $pre;
    }

    $switch = false;
    if ( get_current_blog_id() !== $site_id ) {
        $switch = true;
        remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
        switch_to_blog( $site_id );
    }

    $suppress = $wpdb->suppress_errors();
    $result   = (bool) $wpdb->get_results( "DESCRIBE {$wpdb->posts});
    $wpdb->suppress_errors( $suppress );

    if ( $switch ) {
        restore_current_blog();
        add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
    }

    
function _wp_delete_customize_changeset_dependent_auto_drafts( $post_id ) {
    $post = get_post( $post_id );

    if ( ! $post || 'customize_changeset' !== $post->post_type ) {
        return;
    }

    $data = json_decode( $post->post_content, true );
    if ( empty( $data['nav_menus_created_posts']['value'] ) ) {
        return;
    }
    remove_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' );
    foreach ( $data['nav_menus_created_posts']['value'] as $stub_post_id ) {
        if ( empty( $stub_post_id ) ) {
            continue;
        }
        if ( 'auto-draft' === get_post_status( $stub_post_id ) ) {
            wp_delete_post( $stub_post_id, true );
        } elseif ( 'draft' === get_post_status( $stub_post_id ) ) {
            wp_trash_post( $stub_post_id );
            delete_post_meta( $stub_post_id, '_customize_changeset_uuid' );
        }
    }
    

        } else {
            return ''; // So that the template loader keeps looking for templates.         }
    }

    // Add hooks for template canvas.     // Add viewport meta tag.     add_action( 'wp_head', '_block_template_viewport_meta_tag', 0 );

    // Render title tag with content, regardless of whether theme has title-tag support.     remove_action( 'wp_head', '_wp_render_title_tag', 1 );    // Remove conditional title tag rendering...     add_action( 'wp_head', '_block_template_render_title_tag', 1 ); // ...and make it unconditional.
    // This file will be included instead of the theme's template file.     return ABSPATH . WPINC . '/template-canvas.php';
}

/** * Returns the correct 'wp_template' to render for the request template type. * * @access private * @since 5.8.0 * @since 5.9.0 Added the `$fallback_template` parameter. * * @param string $template_type The current template type. * @param string[] $template_hierarchy The current template hierarchy, ordered by priority. * @param string $fallback_template A PHP fallback template to use if no matching block template is found. * @return WP_Block_Template|null template A template object, or null if none could be found. */


        if ( ! is_main_network() || ! is_main_site() ) {
            return;
        }

        if ( ! WP_Upgrader::create_lock( 'auto_updater' ) ) {
            return;
        }

        // Don't automatically run these things, as we'll handle it ourselves.         remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
        remove_action( 'upgrader_process_complete', 'wp_version_check' );
        remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
        remove_action( 'upgrader_process_complete', 'wp_update_themes' );

        // Next, plugins.         wp_update_plugins(); // Check for plugin updates.         $plugin_updates = get_site_transient( 'update_plugins' );
        if ( $plugin_updates && ! empty( $plugin_updates->response ) ) {
            foreach ( $plugin_updates->response as $plugin ) {
                $this->update( 'plugin', $plugin );
            }
            


            $language_updates_results[] = array(
                'language' => $language_update->language,
                'type'     => $language_update->type,
                'slug'     => isset( $language_update->slug ) ? $language_update->slug : 'default',
                'version'  => $language_update->version,
            );
        }

        // Remove upgrade hooks which are not required for translation updates.         remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
        remove_action( 'upgrader_process_complete', 'wp_version_check' );
        remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
        remove_action( 'upgrader_process_complete', 'wp_update_themes' );

        /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
        do_action(
            'upgrader_process_complete',
            $this,
            array(
                'action'       => 'update',
                'type'         => 'translation',
                
// Default to is-fullscreen-mode to avoid jumps in the UI. add_filter(
    'admin_body_class',
    static function( $classes ) {
        return "$classes is-fullscreen-mode";
    }
);

/* * Emoji replacement is disabled for now, until it plays nicely with React. */
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );

/* * Block editor implements its own Options menu for toggling Document Panels. */
add_filter( 'screen_options_show_screen', '__return_false' );

wp_enqueue_script( 'heartbeat' );
wp_enqueue_script( 'wp-edit-post' );

$rest_path = rest_get_route_for_post( $post );

add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 );

// Counts. add_action( 'admin_init', 'wp_schedule_update_network_counts' );
add_action( 'update_network_counts', 'wp_update_network_counts', 10, 0 );
foreach ( array( 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action ) {
    add_action( $action, 'wp_maybe_update_network_user_counts', 10, 0 );
}

// These counts are handled by wp_update_network_counts() on Multisite: remove_action( 'admin_init', 'wp_schedule_update_user_counts' );
remove_action( 'wp_update_user_counts', 'wp_schedule_update_user_counts' );

foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action ) {
    add_action( $action, 'wp_maybe_update_network_site_counts', 10, 0 );
}
unset( $action );

// Files. add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );
add_filter( 'import_upload_size_limit', 'fix_import_form_size' );
add_filter( 'upload_mimes', 'check_upload_mimes' );
unset( $post_type_meta_caps[ $cap ] );
        }
    }

    /** * Unregisters the post type meta box if a custom callback was specified. * * @since 4.6.0 */
    public function unregister_meta_boxes() {
        if ( $this->register_meta_box_cb ) {
            remove_action( 'add_meta_boxes_' . $this->name, $this->register_meta_box_cb, 10 );
        }
    }

    /** * Removes the post type from all taxonomies. * * @since 4.6.0 */
    public function unregister_taxonomies() {
        foreach ( get_object_taxonomies( $this->name ) as $taxonomy ) {
            unregister_taxonomy_for_object_type( $taxonomy$this->name );
        }

    protected function get_roles_data() {
        global $wp_user_roles;

        if ( ! empty( $wp_user_roles ) ) {
            return $wp_user_roles;
        }

        if ( is_multisite() && get_current_blog_id() != $this->site_id ) {
            remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );

            $roles = get_blog_option( $this->site_id, $this->role_key, array() );

            add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );

            return $roles;
        }

        return get_option( $this->role_key, array() );
    }
}

block_editor_rest_api_preload( $preload_paths$block_editor_context );

$editor_settings = get_block_editor_settings(
    array_merge( get_legacy_widget_block_editor_settings(), array( 'styles' => get_block_editor_theme_styles() ) ),
    $block_editor_context
);

// The widgets editor does not support the Block Directory, so don't load any of // its assets. This also prevents 'wp-editor' from being enqueued which we // cannot load in the widgets screen because many widget scripts rely on `wp.editor`. remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );

wp_add_inline_script(
    'wp-edit-widgets',
    sprintf(
        'wp.domReady( function() { wp.editWidgets.initialize( "widgets-editor", %s ); } );',
        wp_json_encode( $editor_settings )
    )
);

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