[Resolved] Problem with WP 5.4

Home Forums Support Problem with WP 5.4

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1221723
    Hans

    I installed WP 5.4 a few minute ago.

    My site does not work since that time. I got the following warnings:

    Start Frontpage
    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'disable_embeds_rewrites'
     not found or invalid function name in /mnt/web417/a2/76/52551976/htdocs/waehlt/wp-includes/class-wp-hook.php on line 287
    
    Any Userpage
    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'disable_embeds_rewrites'
     not found or invalid function name in /mnt/web417/a2/76/52551976/htdocs/waehlt/wp-includes/class-wp-hook.php on line 287 
    Warning: Cannot modify header information - headers already sent by (output started at /mnt/web417/a2/76/52551976/htdocs/waehlt/wp-includes/class-wp-hook.php:287)
     in /mnt/web417/a2/76/52551976/htdocs/waehlt/wp-includes/pluggable.php on line 1281 
    Warning: Cannot modify header information - headers already sent by (output started at /mnt/web417/a2/76/52551976/htdocs/waehlt/wp-includes/class-wp-hook.php:287)
     in /mnt/web417/a2/76/52551976/htdocs/waehlt/wp-includes/pluggable.php on line 1284
     
     Start Dashbord WordPress
     ng: call_user_func_array() expects parameter 1 to be a valid callback, function 'disable_embeds_rewrites'
     not found or invalid function name in /mnt/web417/a2/76/52551976/htdocs/waehlt/wp-includes/class-wp-hook.php on line 287
    Warning: Cannot modify header information - headers already sent by (output started at /mnt/web417/a2/76/52551976/htdocs/waehlt/wp-includes/class-wp-hook.php:287)
     in /mnt/web417/a2/76/52551976/htdocs/waehlt/wp-admin/admin-header.php on line 9

    I do not find the function waehlt/wp-includes/class-wp-hook.php in WP 5.4. Can you find out which part of my site is invoving this routine?

    I need urgent help as the site must be online in next future and still some work is to be done.Otherwise I have to roll back very soon.

    #1221728
    Hans

    This snippets caused the error:

    /**
     * Disable embeds on init.
     *
     * - Removes the needed query vars.
     * - Disables oEmbed discovery.
     * - Completely removes the related JavaScript.
     *
     * @since 1.0.0
     */
    function evolution_disable_embeds_init() {
        /* @var WP $wp */
        global $wp;
    
        // Remove the embed query var.
        $wp->public_query_vars = array_diff( $wp->public_query_vars, array(
            'embed',
        ) );
    
        // Remove the REST API endpoint.
        remove_action( 'rest_api_init', 'wp_oembed_register_route' );
    
        // Turn off oEmbed auto discovery.
        add_filter( 'embed_oembed_discover', '__return_false' );
    
        // Don't filter oEmbed results.
        remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 );
    
        // Remove oEmbed discovery links.
        remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
    
        // Remove oEmbed-specific JavaScript from the front-end and back-end.
        remove_action( 'wp_head', 'wp_oembed_add_host_js' );
        add_filter( 'tiny_mce_plugins', 'evolution_disable_embeds_tiny_mce_plugin' );
    
        // Remove all embeds rewrite rules.
        add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
    
        // Remove filter of the oEmbed result before any HTTP requests are made.
        remove_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10 );
    }
    
    add_action( 'init', 'evolution_disable_embeds_init', 9999 );
    
    /**
     * Removes the 'wpembed' TinyMCE plugin.
     *
     * @since 1.0.0
     *
     * @param array $plugins List of TinyMCE plugins.
     * @return array The modified list.
     */
    function evolution_disable_embeds_tiny_mce_plugin( $plugins ) {
        return array_diff( $plugins, array( 'wpembed' ) );
    }
    
    /**
     * Remove all rewrite rules related to embeds.
     *
     * @since 1.0.0
     *
     * @param array $rules WordPress rewrite rules.
     * @return array Rewrite rules without embeds rules.
     */
    function evolution_disable_embeds_rewrites( $rules ) {
        foreach ( $rules as $rule => $rewrite ) {
            if ( false !== strpos( $rewrite, 'embed=true' ) ) {
                unset( $rules[ $rule ] );
            }
        }
    
        return $rules;
    }
    
    /**
     * Remove embeds rewrite rules on plugin activation.
     *
     * @since 1.0.0
     */
    function evolution_disable_embeds_remove_rewrite_rules() {
        add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
        flush_rewrite_rules( false );
    }
    
    register_activation_hook( __FILE__, 'evolution_disable_embeds_remove_rewrite_rules' );
    
    /**
     * Flush rewrite rules on plugin deactivation.
     *
     * @since 1.0.0
     */
    function evolution_disable_embeds_flush_rewrite_rules() {
        remove_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
        flush_rewrite_rules( false );
    }
    
    register_deactivation_hook( __FILE__, 'evolution_disable_embeds_flush_rewrite_rules' );
    #1221894
    David
    Staff
    Customer Support

    Hi there,

    glad you found what the issue was.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.