Why is an action callback function from an instance of a class always invoking the same function from an instance?

It’s possible I’m misunderstanding your question, but the way it is written it seems as though every instance of your FilterBuilder class will always get called. Each instance of your class has in its constructor: add_action(‘wp_ajax_myfilter’, array($this, ‘filter_function’)); (as well as the non-logged-in-user version) There is no conditional here telling it when to run based … Read more

How can sanitize $_FILES[‘haq_slider’] field

You don’t say where this code is running – for users or just for admins. Here are a few tips, taken heavily from this article on Wordfence. The first check you can run is current_user_can to see if the current user is allowed to upload files using: if(current_user_can(‘upload_files’)) { …. Next you can use wp_check_filetype … Read more

WooCommerce E-Check payment gateway disappeared when site switched to multi-site

It’s because of this: if ( in_array( ‘woocommerce/woocommerce.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ), true ) ) { self::$instance->setup_constants(); self::$instance->hooks(); self::$instance->includes(); self::$instance->load_textdomain(); add_filter( ‘woocommerce_payment_gateways’, array( self::$instance, ‘add_wc_gateway’ ) ); } The entire class doesn’t do anything if this condition isn’t true: in_array( ‘woocommerce/woocommerce.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ), true ) The problem is that … Read more

Namespaces declared by a theme/plugin should start with the theme/plugin prefix. Found: “eustatos\test_plugin”

At first, we need to update phpcs.xml. Let’s replace “my_prefix” with your plugin name (then, assuming “eustatos”): <rule ref=”WordPress.NamingConventions.PrefixAllGlobals”> <properties> <property name=”prefixes” type=”array”> <element value=”eustatos”/> </property> </properties> </rule> Then, you can use namespace start with eustatos in project PHP file. ex: namespace eustatos\test_plugin; cf. Customizable sniff properties · WordPress/WordPress-Coding-Standards Wiki To execute this check one … Read more

Override WP Class Private Function

As @jacob suggest, you can add subscriber role into that array using add_filter . add below code in active theme’s functions.php file. add_filter( ‘wf_user_permission_roles’, ‘wf_user_permission_roles_callback’ ) ; function wf_user_permission_roles_callback( $roles ) { $roles[] = ‘subscriber’; return $roles; }

What is Stable Tag in WordPress plugin readme file

WordPress.org’s Plugin Directory works based on the information found in the field Stable Tag in the readme. When WordPress.org parses the readme.txt, the very first thing it does is to look at the readme.txt in the /trunk directory, where it reads the “Stable Tag” line. If the Stable Tag is missing, or is set to … Read more