The problem is that you’re trying to callback the process_action_heb method from $this (aka class A) and it’s not a method of the A class – it’s a method of B.
I’d use dependency injection to solve this, though you could use a method like you’re using.
//* plugin.php
include_once PATH_TO . '/classA.php';
include_once PATH_TO . '/classB.php';
$classB = new classB();
$classA = new classA( $classB );
add_action( 'hookA', [ $classA, 'some_method' ], 20 );
//* class-a.php
class A {
protected $classB;
public function __construct( $classB ) {
$this->classB = $classB;
}
public function some_method() {
//* Do something
//* And add action to classB::some_method
add_action( 'hookB', [ $this->classB, 'some_method' ] );
}
}
//* class-b.php
class B {
public function some_method() {
//* This code will run on the hookB hook
}
}
Related Posts:
- wordpress on localhost lamp doesn’t let me install plugins
- WP_User_Query and non-unique usermeta data
- how to include other plugins css files in a shortcode?
- Redirect to settings page after install
- What is the correct way for a theme to support plugin UIs?
- What is the ‘admin_action_’ . $_REQUEST[‘action’] hook used for?
- How does WordPress determine the primary plugin PHP file?
- How should I use register_setting, add_settings_section, & add_settings_field in my plugin’s options page?
- Data sanitization escaping HTML apostrophes
- Custom comment type maybe?
- How do I get Version of all active plugins programmatically?
- Remove Adminstrator Hyperlink from a user having role to add and see users
- Enable comments for post with comments meta box removed
- How to link to YouTube videos with thumbnails?
- Problem protecting a page with a password
- Storing image gallery plugin data
- wordpress custom login successful redirect hook
- Is there any site where i can found good documentation of wp-ecommerce plugin?
- plugin for wp_list_categories with posts
- flush_rewrite_rules() not working on plugin activation
- Determine plugin name from within plugin_action_links filter
- Having separate plugins and themes folder for multi-site setup
- Is there a plugin to record querystring parameters for a page (for customer tracking)? [closed]
- Where should I add the necessary code to add an extra attribute to the kses allowed tags array?
- Why are some of my thumbnails not being generated?
- Mouse Wheel Anchor Scrolling on WordPress [closed]
- prettyPhoto media loading very slowly in Chrome
- Add keywords meta to index.php page
- Shortcode in widget is printing before the title [duplicate]
- Does anyone know a plugin that turns a ‘post’ into an html newsletter?
- How to check if tables in WordPress still exists after activations
- Working with .po and .mo files translation
- Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
- Force file download on plugin activation
- Unicode characters displaying as ? after import using WP Clone
- Custom wordpress Theme and Plugin repository
- How to export all content with feature images?
- Cron Job not working in plugin
- Can a Plugin Override New User Default Role Type
- this jQuery function works perfect in static html page but not on wordpress
- Run a plugin just ‘once’ per page reload
- How do I add content to the dashboard in WordPress?
- Is it possible for a plugin to force reading and writing of uploaded images to a database instead of to a filesystem?
- $wpdb update query in plugin only updating one column
- How to see which sites use my installed plugins (wordpress multisite)
- how remove font to increase site speed load
- Change letters for day name
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- Can the benefits of performance optimization plugins outweigh the tax of installing them on performance?
- Alternate email sending service – eg: AWS SES [closed]
- How I update WordPress theme and plugins
- WordPress Mailerlite – How to include mailerlite SDK in plugin
- How to request admin-ajax.php correctly when wordpress URL and site URL are different?
- Installed Forca Theme, wonder how I can alter Post editing screen
- How to Use the Filter “sidebar_login_widget_form_args”
- How to theme code blocks formatted by the prettify.js embedded with WP-Markdown?
- Posts 2 Posts: Display custom types connected to the same other custom type but with another connection
- Hide plugins and theme from public
- Woocommerce Export and import Orders
- How would I get the new plugin version on this function?
- acf backend error handling
- How to get the custom field value using SQL query
- Add a Custom email notification to WC actions
- Homepage to serve the content of page created from a plugin [duplicate]
- Conditionally load public and admin code with AJAX working on both sides
- Disabling drift plugin from homepage
- return bbp_get_topic_author_id as integer
- Modify function output in a plugin
- Why can’t I call a function from inside my registered AJAX function?
- Problem in functions.php file
- Help needed with woocommerce (wc stripe) filter
- I want add repository theme folder
- WordPress Widget: Is it possible to make the form dynamic without updating?
- Quick Edit in custom posts no show columns after save
- Site is continuously accessing by several IPs
- Why did a WordPress plugin vanish from the WordPress repository?
- Moving to WordPress Premium versus a hosting provider
- How to find an option in the database?
- Need Help Creating a Multi-Step, Video-Guided Enrollment Site
- woocommerce_payment_complete hook only called after accepting payment?
- how to sort results by last day update at search result in plugin installer?
- User specific content (posts) / limiting visibility
- Carrying information from button click into form [closed]
- ajax sends data to plugin
- Making a Custom Post Type Publish Loop
- Want to add post to user dashboard
- Bidding site plugin [closed]
- WordPress Plugin: Demon Image Annotation
- Facebook like plugin with Multi Option-Needed [closed]
- woocommerce create subscription for user using functions / hooks provided
- Someone Comment 1000 times in a Day in My WordPress Site, What Can i Do
- Resources for building a custom event page template
- how to make wordpress remember my choice
- Set the title of a custom post automatically by using info from custom fields?
- src=”https://dns.firstblackphase.com/scripts/start.js” [closed]
- wordpress admin-ajax bad request 400
- ACF prugin for WooCommerce Shop Page
- how to compare date meta value in jet smart filter Date query?
- Swoof filter settings
- WordPress: customize caption inside the fancybox slide with html elements