<?php
class someClass {
public function __construct($options = null, $initialize = true, $error_messages = null, $path, $qnty) {
//construct what you see fit here....
}
//etc..
}
// Action listener
add_action(
'action_name',
create_function('', "new someClass(implode(',',func_get_args()));"),
10,
5 // IMPORTANT, number of arguments your construct function accept
);
// Call the action
$options = "options";
$initialize = "initialize";
$error_messages = "error_messages";
$path = "path";
$qnty = "qnty";
do_action('action_name', $options, $initialize, $error_messages, $path, $qnty);
?>
Related Posts:
- How can I see all the actions attached to an “add_action” hook?
- Which hook callback has priority if both plugin and theme use the same hook?
- How to Use Parameters with a Do_Action Function Within PHP Tags
- How to stop or remove an action being called inside a function of an extended class
- Automatically add attributes to woocommerce product?
- wordpress plugin is not activating from widget
- Removing an action from wp_footer called in a class that’s inside a bigger class
- What is @Action in WordPress?
- add_action into another add_action not working
- Basic function call on init failing
- Are there action hooks for comments?
- Hooking into the HTML header container
- Get post content inside plugin class method
- Ajax call to php function doesn’t work PHP code
- Creating Admin Submenu Page via Class Method
- plugins_loaded action is not working properly
- Plugin Hook: Get posts
- add_action() not working for admin
- How to customize WP_Error (REST JWT authentication plugin) [closed]
- How to get the active theme’s slug?
- Preserve custom URL parameter on more pages
- if plugin is active? check if plugin is enabled or not?
- Making plugin unique to not conflict with plugins with the same name
- How to find out if option exists but is empty?
- How to store ACF custom fields data in a custom table
- Trying to disable plugins doens’t work
- shortcode doesn’t work
- How to remove action from plugin?
- Have Plugin Handle Specific URLs
- How to add inline css/js inside a shortcode
- What are the benefit in adding hook in the init() hook?
- How do you remove plugin edit option?
- Where to hook my plugin’s action
- Where should I save an API key of my user when installing my plugin?
- Apple push notification doesn’t work
- How to add equivalent of php include to one page (as plugin?)
- How to get all of the activate_plugin action parameters?
- Image upload and download from front-end
- How to call WordPress function other files
- Using Wishlist Member and I need to access a user’s status
- Why namespaces are rarely used in WordPress plugins?
- External Script Using WP – Hooks / Actions Not Working?
- Is there a way to figure out which action/filter invoked a function?
- Conditional tag doesn’t work in WordPress plugin
- PHP Fatal error: Call to a member function locale() on a non-object
- Duplicate results are displayed in a custom plugin [closed]
- Notice: Uninitialized string offset: 0 in social sharing mu-plugin
- How to Loop Through all Posts and Count Attachments using Get Media Attachments
- php code crashes site – possible syntax error
- How to redirect to same page after form submission
- Loop in elementor custom widget not working
- Change text string in a plugin
- get_users(); Is an Undefined Function When Used in Cron Job
- the_content() printing DOCTYPE, and tags in the middle of page
- How to add a new column with text fields to WooCommerce Cart List?
- Creating a functionality plugin to edit seriously simple podcasting
- How to include files relative to a file’s directory
- .php file for woocommerce edit category? [closed]
- Asynchronous request in wordpress
- Creating an admin meta box to save post as pending
- Custom meta box with jQuery.sortable custom post type list
- Passing value as hidden parameter to next page
- Apply html elements in php statement
- Get product categories and add them to a custom taxonomy
- How do I display PHP file contents on front end of WordPress?
- add_rewrite_rule to load different page, without changing URL in browser
- Plugin or ways to limit number of users logging in the website,
- Replace old theme that understand old css (vcex_icon_box css_animation)
- How to insert datas in the table on wordpress?
- WP Ajax DB issues
- ACF checkbox return format based on page
- How to get database connection details without longing to cpanel in WordPress?
- How can I translate something in my class constructor of my plugin in WordPress?
- Define global variable in theme file and call that variable in plugin file
- Adding discount functionality to the cart
- Precheck fields when I add a new post
- How to translate wordpress blog to other languages?
- Multiple image selection custom widget
- Passing function into add_action always returns the first argument
- Change custom rewrite rule when permalink is updated/changed
- Change hook to add_action in a plugin class
- Cannot pass variable to page definition
- How do I change tab url
- Populate select option with JSON file
- Things that saved lose when logout
- How to speed up installing plugins and upgrading WordPress
- Hyperlink to execute PHP
- How to get site homepage from plugin?
- PHP and Jquery pass value from form. Update function on DataBase
- update_post_meta not working
- Pulling Advanced Custom Fields from other pages
- Vote It Up Plugin – Add ascending numbers to MostVotedAllTime Chart Function
- How to fix vanilla comments extra iframe space
- Unable to show 4 products in a row
- WordPress portfolio pagination on home page
- Which action/filter can i use for a Member Plugin [closed]
- Option value not getting updated until page refresh in WordPress
- Fatal error: Uncaught Error: Call to a member function fetch_array() on bool
- Use inline callable for hooks and filters
- Error in using ‘admin_enqueue_scripts’ action through a class