• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Point me in the right direction (error log)

iKalanko

Active member
Babiato Lover
Dec 23, 2019
197
62
28
I check a woocommerce website Im making and got this errors:

Code:
[12-Feb-2023 20:48:47 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 1398 made by do_action('wp_ajax_customize_save'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Customize_Manager->save, WP_Customize_Manager->save_changeset_post, wp_update_post, wp_insert_post, wp_transition_post_status, do_action('transition_post_status'), WP_Hook->do_action, WP_Hook->apply_filters, _wp_customize_publish_changeset, WP_Customize_Manager->trash_changeset_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:01 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 438 made by wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:01 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 437 made by wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:02 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 436 made by wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:02 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 435 made by wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:02 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 16 made by wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:02 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 15 made by wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:02 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 14 made by wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:13 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 1264 made by wp_trash_post, do_action('wp_trash_post'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Post_Data::trash_post, WC_Data_Store->__call, WC_Product_Variable_Data_Store_CPT->delete_variations, wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:13 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 1263 made by wp_trash_post, do_action('wp_trash_post'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Post_Data::trash_post, WC_Data_Store->__call, WC_Product_Variable_Data_Store_CPT->delete_variations, wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:13 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 1262 made by wp_trash_post, do_action('wp_trash_post'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Post_Data::trash_post, WC_Data_Store->__call, WC_Product_Variable_Data_Store_CPT->delete_variations, wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:13 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 1261 made by wp_trash_post, do_action('wp_trash_post'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Post_Data::trash_post, WC_Data_Store->__call, WC_Product_Variable_Data_Store_CPT->delete_variations, wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 20:54:13 UTC] WordPress database error Table 'yourserver_sh0p1.tga89_mclean_scan' doesn't exist for query DELETE FROM tga89_mclean_scan WHERE postId = 860 made by wp_trash_post, do_action('trashed_post'), WP_Hook->do_action, WP_Hook->apply_filters, Meow_WPMC_Core->delete_attachment_related_data
[12-Feb-2023 22:27:39 UTC] Failed to insert log entry: WordPress database error: Processing the value for the following field failed: code. The supplied value may be too long or contains invalid data.
[12-Feb-2023 22:27:43 UTC] Failed to insert log entry: WordPress database error: Processing the value for the following field failed: code. The supplied value may be too long or contains invalid data.
[13-Feb-2023 00:53:09 UTC] Failed to insert log entry: WordPress database error: Processing the value for the following field failed: code. The supplied value may be too long or contains invalid data.
[13-Feb-2023 00:53:20 UTC] Failed to insert log entry: WordPress database error: Processing the value for the following field failed: code. The supplied value may be too long or contains invalid data.
[13-Feb-2023 03:27:16 UTC] wc_get_product was called incorrectly. wc_get_product should not be called before the woocommerce_init, woocommerce_after_register_taxonomy and woocommerce_after_register_post_type actions have finished. Backtrace: require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce->init, wc_load_cart, WooCommerce->initialize_session, WC_Session_Handler->init, WC_Session_Handler->init_session_cookie, WC_Session_Handler->destroy_session, WC_Session_Handler->forget_session, wc_empty_cart, WC_Cart->empty_cart, do_action('woocommerce_cart_emptied'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Ship_Multiple->clear_session, wcms_session_get, WC_Session->__get, WC_Session->get, maybe_unserialize, unserialize, WC_Data->__wakeup, WC_Product_Variation->__construct, WC_Product_Simple->__construct, WC_Product->__construct, WC_Data_Store->read, WC_Product_Variation_Data_Store_CPT->read, WC_Product_Variation_Data_Store_CPT->generate_attribute_summary, wc_get_formatted_variation, wc_attribute_label, wc_get_product, wc_doing_it_wrong. This message was added in version 3.9.
[13-Feb-2023 03:27:16 UTC] wc_get_product was called incorrectly. wc_get_product should not be called before the woocommerce_init, woocommerce_after_register_taxonomy and woocommerce_after_register_post_type actions have finished. Backtrace: require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce->init, wc_load_cart, WooCommerce->initialize_session, WC_Session_Handler->init, WC_Session_Handler->init_session_cookie, WC_Session_Handler->destroy_session, WC_Session_Handler->forget_session, wc_empty_cart, WC_Cart->empty_cart, do_action('woocommerce_cart_emptied'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Ship_Multiple->clear_session, wcms_session_get, WC_Session->__get, WC_Session->get, maybe_unserialize, unserialize, WC_Data->__wakeup, WC_Product_Variation->__construct, WC_Product_Simple->__construct, WC_Product->__construct, WC_Data_Store->read, WC_Product_Variation_Data_Store_CPT->read, WC_Product_Variation_Data_Store_CPT->generate_attribute_summary, wc_get_formatted_variation, wc_attribute_label, wc_get_product, wc_doing_it_wrong. This message was added in version 3.9.

One of the plugins giving me that error is the ''Media Cleaner Pro"

I also got this error today with the plugin "Registration & Login with Mobile Phone Number":

Code:
[12-Feb-2023 19:42:54 UTC] PHP Warning:  Trying to access array offset on value of type null in /home/yourserver/public_html/main/wp-content/plugins/registration-login-with-mobile-phone-number/front-end/login-with-phone-number-front-end.php on line 704
[12-Feb-2023 19:42:54 UTC] PHP Warning:  Trying to access array offset on value of type null in /home/yourserver/public_html/main/wp-content/plugins/registration-login-with-mobile-phone-number/front-end/login-with-phone-number-front-end.php on line 706
[12-Feb-2023 20:33:56 UTC] PHP Warning:  Trying to access array offset on value of type null in /home/yourserver/public_html/main/wp-content/plugins/registration-login-with-mobile-phone-number/front-end/login-with-phone-number-front-end.php on line 1245
[12-Feb-2023 20:33:56 UTC] PHP Warning:  Trying to access array offset on value of type null in /home/yourserver/public_html/main/wp-content/plugins/registration-login-with-mobile-phone-number/front-end/login-with-phone-number-front-end.php on line 1246
[12-Feb-2023 20:33:56 UTC] PHP Warning:  Trying to access array offset on value of type null in /home/yourserver/public_html/main/wp-content/plugins/registration-login-with-mobile-phone-number/front-end/login-with-phone-number-front-end.php on line 1574
[12-Feb-2023 20:33:56 UTC] PHP Warning:  Trying to access array offset on value of type null in /home/yourserver/public_html/main/wp-content/plugins/registration-login-with-mobile-phone-number/front-end/login-with-phone-number-front-end.php on line 1575

Appreciate the time and help you guys could give me.
 
I check a woocommerce website Im making and got this errors:
Your media cleaner was installed incorrectly or table is incorrectly named.
For log entry it seems that your data is incompatible or larger with/than defined field in table.
for Woocommerce call find class-woocommerce.php
and this code
Code:
if ( $this->is_request( 'frontend' ) ) {
   wc_load_cart();
}

$this->load_webhooks();

// Init action.
do_action( 'woocommerce_init' );

change it with this
Code:
$this->load_webhooks();

// Init action.
do_action( 'woocommerce_init' );

// Classes/actions loaded for the frontend and for ajax requests.
if ( $this->is_request( 'frontend' ) ) {
   wc_load_cart();
}

I also got this error today with the plugin "Registration & Login with Mobile Phone Number":
Do you have a geoplugin installed? Because all warnings refer to
Code:
$jsonData['geoplugin_countryName']
$jsonData['geoplugin_city']
 
for Woocommerce call find class-woocommerce.php
and this code
Code:
if ( $this->is_request( 'frontend' ) ) {
   wc_load_cart();
}

$this->load_webhooks();

// Init action.
do_action( 'woocommerce_init' );

change it with this
Code:
$this->load_webhooks();

// Init action.
do_action( 'woocommerce_init' );

// Classes/actions loaded for the frontend and for ajax requests.
if ( $this->is_request( 'frontend' ) ) {
   wc_load_cart();
}


Do you have a geoplugin installed? Because all warnings refer to
Code:
$jsonData['geoplugin_countryName']
$jsonData['geoplugin_city']

This is how I got it so how it would be?
Code:
        // Classes/actions loaded for the frontend and for ajax requests.
        if ( $this->is_request( 'frontend' ) ) {
            wc_load_cart();
        }

        $this->load_webhooks();

        /**
         * Action triggered after WooCommerce initialization finishes.
         */
        do_action( 'woocommerce_init' ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingSinceComment
    }

    /**
Thank you very much for your help
 
Just have the if statement with wc_load_cart after do_action(woocommerce_init)
 
  • Like
Reactions: iKalanko
These errors suggest that WordPress is trying to perform database operations on a table called tga89_mclean_scan but the table does not exist in the database. The errors occur in various places such as when saving changes in the Customize Manager, trashing posts, or deleting product variations in WooCommerce.

The errors are likely caused by a plugin or theme that is trying to access this table. It's possible that the plugin or theme created the table but didn't properly delete it when it was deactivated or uninstalled.

To fix the issue, you can try the following steps:

  1. Check if the plugin or theme that might have created the table is still active. If it is, deactivate it and see if the errors go away.
  2. If the plugin or theme is not active, try reinstalling it and then deactivating it properly.
  3. If the errors persist after trying the above steps, you can try manually creating the missing table in the database. However, this should only be done if you are comfortable working with databases and have a backup of your website. You can use a tool like phpMyAdmin to create the table.
  4. If none of the above steps work, you may need to contact the plugin or theme developer for assistance.
In any case, it's important to make sure you have a backup of your website before making any changes to your database.
 
  • Like
Reactions: iKalanko
These errors suggest that WordPress is trying to perform database operations on a table called tga89_mclean_scan but the table does not exist in the database. The errors occur in various places such as when saving changes in the Customize Manager, trashing posts, or deleting product variations in WooCommerce.

The errors are likely caused by a plugin or theme that is trying to access this table. It's possible that the plugin or theme created the table but didn't properly delete it when it was deactivated or uninstalled.

To fix the issue, you can try the following steps:

  1. Check if the plugin or theme that might have created the table is still active. If it is, deactivate it and see if the errors go away.
  2. If the plugin or theme is not active, try reinstalling it and then deactivating it properly.
  3. If the errors persist after trying the above steps, you can try manually creating the missing table in the database. However, this should only be done if you are comfortable working with databases and have a backup of your website. You can use a tool like phpMyAdmin to create the table.
  4. If none of the above steps work, you may need to contact the plugin or theme developer for assistance.
In any case, it's important to make sure you have a backup of your website before making any changes to your database.
what about when its a migration?
 
Well hell, thats

The world’s most trusted WordPress backup, restore and clone plugin​

what im saying is in order to restore with that plugin i need to create a new wp so maybe im using the new tables instead of the old ones? idk but ill try your steps. :)
 
Code:
[27-Feb-2023 15:39:06 UTC] PHP Fatal error:  Uncaught Error: Unknown named parameter $interval in /home/yourhost/public_html/iptv10/wp-includes/class-wp-hook.php:308
Stack trace:
#0 /home/yourhost/public_html/iptv10/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#1 /home/yourhost/public_html/iptv10/wp-includes/plugin.php(565): WP_Hook->do_action()
#2 /home/yourhost/public_html/iptv10/wp-cron.php(188): do_action_ref_array()
#3 {main}
  thrown in /home/yourhost/public_html/iptv10/wp-includes/class-wp-hook.php on line 308

Got this one on one of my iptv pages. Appreciate all your responses.
Theme used: Divi
Plugins Installed: iThemes Security, Perfmatters, Media Cleaner Pro, WP-Rocket, UpDraftPlus, WP Mail SMTP and WPCodeBox
 
Code:
[27-Feb-2023 15:39:06 UTC] PHP Fatal error:  Uncaught Error: Unknown named parameter $interval in /home/yourhost/public_html/iptv10/wp-includes/class-wp-hook.php:308
Stack trace:
#0 /home/yourhost/public_html/iptv10/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#1 /home/yourhost/public_html/iptv10/wp-includes/plugin.php(565): WP_Hook->do_action()
#2 /home/yourhost/public_html/iptv10/wp-cron.php(188): do_action_ref_array()
#3 {main}
  thrown in /home/yourhost/public_html/iptv10/wp-includes/class-wp-hook.php on line 308

Got this one on one of my iptv pages. Appreciate all your responses.
Theme used: Divi
Plugins Installed: iThemes Security, Perfmatters, Media Cleaner Pro, WP-Rocket, UpDraftPlus, WP Mail SMTP and WPCodeBox
This error message indicates that there is an issue with the named parameter $interval in the file /home/yourhost/public_html/iptv10/wp-includes/class-wp-hook.php on line 308. The parameter may be missing or named incorrectly.
 
  • Like
Reactions: iKalanko
This error message indicates that there is an issue with the named parameter $interval in the file /home/yourhost/public_html/iptv10/wp-includes/class-wp-hook.php on line 308. The parameter may be missing or named incorrectly.
Code:
                // Avoid the array_slice() if possible.
                if ( 0 == $the_['accepted_args'] ) {
                    $value = call_user_func( $the_['function'] );
                } elseif ( $the_['accepted_args'] >= $num_args ) {
                    $value = call_user_func_array( $the_['function'], $args );
                } else {
                    $value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
                }
            }
        } while ( false !== next( $this->iterations[ $nesting_level ] ) );

        unset( $this->iterations[ $nesting_level ] );
        unset( $this->current_priority[ $nesting_level ] );

        $this->nesting_level--;

        return $value;
    }

Is there something wrong in this code?
 
The error message further indicates that the parameter may be missing or named incorrectly. but without the full code there is no way to find out.
 
  • Like
Reactions: iKalanko
All looks right However, it's difficult to say without the full context
Code:
<?php
/**
 * Plugin API: WP_Hook class
 *
 * @package WordPress
 * @subpackage Plugin
 * @since 4.7.0
 */

/**
 * Core class used to implement action and filter hook functionality.
 *
 * @since 4.7.0
 *
 * @see Iterator
 * @see ArrayAccess
 */
#[AllowDynamicProperties]
final class WP_Hook implements Iterator, ArrayAccess {

    /**
     * Hook callbacks.
     *
     * @since 4.7.0
     * @var array
     */
    public $callbacks = array();

    /**
     * The priority keys of actively running iterations of a hook.
     *
     * @since 4.7.0
     * @var array
     */
    private $iterations = array();

    /**
     * The current priority of actively running iterations of a hook.
     *
     * @since 4.7.0
     * @var array
     */
    private $current_priority = array();

    /**
     * Number of levels this hook can be recursively called.
     *
     * @since 4.7.0
     * @var int
     */
    private $nesting_level = 0;

    /**
     * Flag for if we're currently doing an action, rather than a filter.
     *
     * @since 4.7.0
     * @var bool
     */
    private $doing_action = false;

    /**
     * Adds a callback function to a filter hook.
     *
     * @since 4.7.0
     *
     * @param string   $hook_name     The name of the filter to add the callback to.
     * @param callable $callback      The callback to be run when the filter is applied.
     * @param int      $priority      The order in which the functions associated with a particular filter
     *                                are executed. Lower numbers correspond with earlier execution,
     *                                and functions with the same priority are executed in the order
     *                                in which they were added to the filter.
     * @param int      $accepted_args The number of arguments the function accepts.
     */
    public function add_filter( $hook_name, $callback, $priority, $accepted_args ) {
        $idx = _wp_filter_build_unique_id( $hook_name, $callback, $priority );

        $priority_existed = isset( $this->callbacks[ $priority ] );

        $this->callbacks[ $priority ][ $idx ] = array(
            'function'      => $callback,
            'accepted_args' => $accepted_args,
        );

        // If we're adding a new priority to the list, put them back in sorted order.
        if ( ! $priority_existed && count( $this->callbacks ) > 1 ) {
            ksort( $this->callbacks, SORT_NUMERIC );
        }

        if ( $this->nesting_level > 0 ) {
            $this->resort_active_iterations( $priority, $priority_existed );
        }
    }

    /**
     * Handles resetting callback priority keys mid-iteration.
     *
     * @since 4.7.0
     *
     * @param false|int $new_priority     Optional. The priority of the new filter being added. Default false,
     *                                    for no priority being added.
     * @param bool      $priority_existed Optional. Flag for whether the priority already existed before the new
     *                                    filter was added. Default false.
     */
    private function resort_active_iterations( $new_priority = false, $priority_existed = false ) {
        $new_priorities = array_keys( $this->callbacks );

        // If there are no remaining hooks, clear out all running iterations.
        if ( ! $new_priorities ) {
            foreach ( $this->iterations as $index => $iteration ) {
                $this->iterations[ $index ] = $new_priorities;
            }

            return;
        }

        $min = min( $new_priorities );

        foreach ( $this->iterations as $index => &$iteration ) {
            $current = current( $iteration );

            // If we're already at the end of this iteration, just leave the array pointer where it is.
            if ( false === $current ) {
                continue;
            }

            $iteration = $new_priorities;

            if ( $current < $min ) {
                array_unshift( $iteration, $current );
                continue;
            }

            while ( current( $iteration ) < $current ) {
                if ( false === next( $iteration ) ) {
                    break;
                }
            }

            // If we have a new priority that didn't exist, but ::apply_filters() or ::do_action() thinks it's the current priority...
            if ( $new_priority === $this->current_priority[ $index ] && ! $priority_existed ) {
                /*
                 * ...and the new priority is the same as what $this->iterations thinks is the previous
                 * priority, we need to move back to it.
                 */

                if ( false === current( $iteration ) ) {
                    // If we've already moved off the end of the array, go back to the last element.
                    $prev = end( $iteration );
                } else {
                    // Otherwise, just go back to the previous element.
                    $prev = prev( $iteration );
                }

                if ( false === $prev ) {
                    // Start of the array. Reset, and go about our day.
                    reset( $iteration );
                } elseif ( $new_priority !== $prev ) {
                    // Previous wasn't the same. Move forward again.
                    next( $iteration );
                }
            }
        }

        unset( $iteration );
    }

    /**
     * Removes a callback function from a filter hook.
     *
     * @since 4.7.0
     *
     * @param string                $hook_name The filter hook to which the function to be removed is hooked.
     * @param callable|string|array $callback  The callback to be removed from running when the filter is applied.
     *                                         This method can be called unconditionally to speculatively remove
     *                                         a callback that may or may not exist.
     * @param int                   $priority  The exact priority used when adding the original filter callback.
     * @return bool Whether the callback existed before it was removed.
     */
    public function remove_filter( $hook_name, $callback, $priority ) {
        $function_key = _wp_filter_build_unique_id( $hook_name, $callback, $priority );

        $exists = isset( $this->callbacks[ $priority ][ $function_key ] );

        if ( $exists ) {
            unset( $this->callbacks[ $priority ][ $function_key ] );

            if ( ! $this->callbacks[ $priority ] ) {
                unset( $this->callbacks[ $priority ] );

                if ( $this->nesting_level > 0 ) {
                    $this->resort_active_iterations();
                }
            }
        }

        return $exists;
    }

    /**
     * Checks if a specific callback has been registered for this hook.
     *
     * When using the `$callback` argument, this function may return a non-boolean value
     * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
     *
     * @since 4.7.0
     *
     * @param string                      $hook_name Optional. The name of the filter hook. Default empty.
     * @param callable|string|array|false $callback  Optional. The callback to check for.
     *                                               This method can be called unconditionally to speculatively check
     *                                               a callback that may or may not exist. Default false.
     * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
     *                  anything registered. When checking a specific function, the priority
     *                  of that hook is returned, or false if the function is not attached.
     */
    public function has_filter( $hook_name = '', $callback = false ) {
        if ( false === $callback ) {
            return $this->has_filters();
        }

        $function_key = _wp_filter_build_unique_id( $hook_name, $callback, false );

        if ( ! $function_key ) {
            return false;
        }

        foreach ( $this->callbacks as $priority => $callbacks ) {
            if ( isset( $callbacks[ $function_key ] ) ) {
                return $priority;
            }
        }

        return false;
    }

    /**
     * Checks if any callbacks have been registered for this hook.
     *
     * @since 4.7.0
     *
     * @return bool True if callbacks have been registered for the current hook, otherwise false.
     */
    public function has_filters() {
        foreach ( $this->callbacks as $callbacks ) {
            if ( $callbacks ) {
                return true;
            }
        }

        return false;
    }

    /**
     * Removes all callbacks from the current filter.
     *
     * @since 4.7.0
     *
     * @param int|false $priority Optional. The priority number to remove. Default false.
     */
    public function remove_all_filters( $priority = false ) {
        if ( ! $this->callbacks ) {
            return;
        }

        if ( false === $priority ) {
            $this->callbacks = array();
        } elseif ( isset( $this->callbacks[ $priority ] ) ) {
            unset( $this->callbacks[ $priority ] );
        }

        if ( $this->nesting_level > 0 ) {
            $this->resort_active_iterations();
        }
    }

    /**
     * Calls the callback functions that have been added to a filter hook.
     *
     * @since 4.7.0
     *
     * @param mixed $value The value to filter.
     * @param array $args  Additional parameters to pass to the callback functions.
     *                     This array is expected to include $value at index 0.
     * @return mixed The filtered value after all hooked functions are applied to it.
     */
    public function apply_filters( $value, $args ) {
        if ( ! $this->callbacks ) {
            return $value;
        }

        $nesting_level = $this->nesting_level++;

        $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
        $num_args                           = count( $args );

        do {
            $this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
            $priority                                 = $this->current_priority[ $nesting_level ];

            foreach ( $this->callbacks[ $priority ] as $the_ ) {
                if ( ! $this->doing_action ) {
                    $args[0] = $value;
                }

                // Avoid the array_slice() if possible.
                if ( 0 == $the_['accepted_args'] ) {
                    $value = call_user_func( $the_['function'] );
                } elseif ( $the_['accepted_args'] >= $num_args ) {
                    $value = call_user_func_array( $the_['function'], $args );
                } else {
                    $value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
                }
            }
        } while ( false !== next( $this->iterations[ $nesting_level ] ) );

        unset( $this->iterations[ $nesting_level ] );
        unset( $this->current_priority[ $nesting_level ] );

        $this->nesting_level--;

        return $value;
    }

    /**
     * Calls the callback functions that have been added to an action hook.
     *
     * @since 4.7.0
     *
     * @param array $args Parameters to pass to the callback functions.
     */
    public function do_action( $args ) {
        $this->doing_action = true;
        $this->apply_filters( '', $args );

        // If there are recursive calls to the current action, we haven't finished it until we get to the last one.
        if ( ! $this->nesting_level ) {
            $this->doing_action = false;
        }
    }

    /**
     * Processes the functions hooked into the 'all' hook.
     *
     * @since 4.7.0
     *
     * @param array $args Arguments to pass to the hook callbacks. Passed by reference.
     */
    public function do_all_hook( &$args ) {
        $nesting_level                      = $this->nesting_level++;
        $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );

        do {
            $priority = current( $this->iterations[ $nesting_level ] );

            foreach ( $this->callbacks[ $priority ] as $the_ ) {
                call_user_func_array( $the_['function'], $args );
            }
        } while ( false !== next( $this->iterations[ $nesting_level ] ) );

        unset( $this->iterations[ $nesting_level ] );
        $this->nesting_level--;
    }

    /**
     * Return the current priority level of the currently running iteration of the hook.
     *
     * @since 4.7.0
     *
     * @return int|false If the hook is running, return the current priority level.
     *                   If it isn't running, return false.
     */
    public function current_priority() {
        if ( false === current( $this->iterations ) ) {
            return false;
        }

        return current( current( $this->iterations ) );
    }

    /**
     * Normalizes filters set up before WordPress has initialized to WP_Hook objects.
     *
     * The `$filters` parameter should be an array keyed by hook name, with values
     * containing either:
     *
     *  - A `WP_Hook` instance
     *  - An array of callbacks keyed by their priorities
     *
     * Examples:
     *
     *     $filters = array(
     *         'wp_fatal_error_handler_enabled' => array(
     *             10 => array(
     *                 array(
     *                     'accepted_args' => 0,
     *                     'function'      => function() {
     *                         return false;
     *                     },
     *                 ),
     *             ),
     *         ),
     *     );
     *
     * @since 4.7.0
     *
     * @param array $filters Filters to normalize. See documentation above for details.
     * @return WP_Hook[] Array of normalized filters.
     */
    public static function build_preinitialized_hooks( $filters ) {
        /** @var WP_Hook[] $normalized */
        $normalized = array();

        foreach ( $filters as $hook_name => $callback_groups ) {
            if ( is_object( $callback_groups ) && $callback_groups instanceof WP_Hook ) {
                $normalized[ $hook_name ] = $callback_groups;
                continue;
            }

            $hook = new WP_Hook();

            // Loop through callback groups.
            foreach ( $callback_groups as $priority => $callbacks ) {

                // Loop through callbacks.
                foreach ( $callbacks as $cb ) {
                    $hook->add_filter( $hook_name, $cb['function'], $priority, $cb['accepted_args'] );
                }
            }

            $normalized[ $hook_name ] = $hook;
        }

        return $normalized;
    }

    /**
     * Determines whether an offset value exists.
     *
     * @since 4.7.0
     *
     * @link https://www.php.net/manual/en/arrayaccess.offsetexists.php
     *
     * @param mixed $offset An offset to check for.
     * @return bool True if the offset exists, false otherwise.
     */
    #[ReturnTypeWillChange]
    public function offsetExists( $offset ) {
        return isset( $this->callbacks[ $offset ] );
    }

    /**
     * Retrieves a value at a specified offset.
     *
     * @since 4.7.0
     *
     * @link https://www.php.net/manual/en/arrayaccess.offsetget.php
     *
     * @param mixed $offset The offset to retrieve.
     * @return mixed If set, the value at the specified offset, null otherwise.
     */
    #[ReturnTypeWillChange]
    public function offsetGet( $offset ) {
        return isset( $this->callbacks[ $offset ] ) ? $this->callbacks[ $offset ] : null;
    }

    /**
     * Sets a value at a specified offset.
     *
     * @since 4.7.0
     *
     * @link https://www.php.net/manual/en/arrayaccess.offsetset.php
     *
     * @param mixed $offset The offset to assign the value to.
     * @param mixed $value The value to set.
     */
    #[ReturnTypeWillChange]
    public function offsetSet( $offset, $value ) {
        if ( is_null( $offset ) ) {
            $this->callbacks[] = $value;
        } else {
            $this->callbacks[ $offset ] = $value;
        }
    }

    /**
     * Unsets a specified offset.
     *
     * @since 4.7.0
     *
     * @link https://www.php.net/manual/en/arrayaccess.offsetunset.php
     *
     * @param mixed $offset The offset to unset.
     */
    #[ReturnTypeWillChange]
    public function offsetUnset( $offset ) {
        unset( $this->callbacks[ $offset ] );
    }

    /**
     * Returns the current element.
     *
     * @since 4.7.0
     *
     * @link https://www.php.net/manual/en/iterator.current.php
     *
     * @return array Of callbacks at current priority.
     */
    #[ReturnTypeWillChange]
    public function current() {
        return current( $this->callbacks );
    }

    /**
     * Moves forward to the next element.
     *
     * @since 4.7.0
     *
     * @link https://www.php.net/manual/en/iterator.next.php
     *
     * @return array Of callbacks at next priority.
     */
    #[ReturnTypeWillChange]
    public function next() {
        return next( $this->callbacks );
    }

    /**
     * Returns the key of the current element.
     *
     * @since 4.7.0
     *
     * @link https://www.php.net/manual/en/iterator.key.php
     *
     * @return mixed Returns current priority on success, or NULL on failure
     */
    #[ReturnTypeWillChange]
    public function key() {
        return key( $this->callbacks );
    }

    /**
     * Checks if current position is valid.
     *
     * @since 4.7.0
     *
     * @link https://www.php.net/manual/en/iterator.valid.php
     *
     * @return bool Whether the current position is valid.
     */
    #[ReturnTypeWillChange]
    public function valid() {
        return key( $this->callbacks ) !== null;
    }

    /**
     * Rewinds the Iterator to the first element.
     *
     * @since 4.7.0
     *
     * @link https://www.php.net/manual/en/iterator.rewind.php
     */
    #[ReturnTypeWillChange]
    public function rewind() {
        reset( $this->callbacks );
    }

}
Full code
 
Maybe This?

Replace code
Code:
        $nesting_level = $this->nesting_level++;

        $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
        $num_args                           = count( $args );

        do {
            $this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
            $priority

With

Code:
        $nesting_level = $this->nesting_level++;

        $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
        $num_args = count( $args );

        do {
            $this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
            $priority

Maybe the long space between args and = is causing the issue?
 
  • Like
Reactions: iKalanko
Maybe This?

Replace code
Code:
        $nesting_level = $this->nesting_level++;

        $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
        $num_args                           = count( $args );

        do {
            $this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
            $priority

With

Code:
        $nesting_level = $this->nesting_level++;

        $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
        $num_args = count( $args );

        do {
            $this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
            $priority

Maybe the long space between args and = is causing the issue?
Will try, appreciate your time and help. :)
 
  • Like
Reactions: ShelShock

Forum statistics

Threads
79,303
Messages
1,138,671
Members
247,793
Latest member
ngocxu
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock