actions's questions - English 1answer

1.066 actions questions.

In my plugin, I am doing a minimum-supported PHP version compatibility check via a function bound to register_activation_hook and halting activation for those on PHP version less than the minimum ...

I'm using the following code to create a custom metabox on a custom taxonomy page. $term_filter_name_edit = $type . '_edit_form_fields'; add_action($term_filter_name_edit, 'box_term', 1000, 1 ); ...

In general, I try to apply a "load more post" functionality to a loop, but I am failing to fire a PHP function within a plugin. The PHP function is supposed to fire using a custom jQuery action with ...

I have a custom post type that always do math operation to its post_meta and other custom post type post_meta. For example: post-type 1 = cpt_product_order post-type 1 post_meta = ...

I created a class extend WP_List_Table and created method for bulk actions like this : function get_bulk_actions() { $actions = array( 'synchronize' => 'Synchronize', ...

I want to get the menu location in the wp_update_nav_menu (during menu save action) add_action('wp_update_nav_menu', function ($id, $data = NULL) { error_log( var_export($data, true) ); ...

I am creating something for a client and I have a Class that I created with a Custom Post Type called 'PuSH Feeds' and when the user adds a new post and publishes it they can then click on one of two ...

I created a login form in the frontend with wp_login_form(). In my functions.php file I added an action to prevent the redirect to /wp-login.php if the login failed with add_action('...

I am writing a plugin that fetches some extended user info from a remote service and I need it to execute its function each time a user logs in. Is there a hook that gets fired after login that I can ...

I use the http://www.deluxeblogtips.com/meta-box Metabox plugin and I want to add a custom action in a post type like the publish button ? when admin click on this button I want to send an email to ...

A Payment Gateway I am using expects only Croatian currency so I am trying to update cart total and its currency by using a filter on placing order if the currency is Euro. I have successfully change ...

I'm trying to create a remove action for the woocommerce points and rewards plugin but I cannot get it to work. I haven't tried to remove an action that's like this before so any help would be ...

I'm trying to do something similar to this question here: remove_action or remove_filter with external classes? I'm trying to remove the <!-- This site is optimized with the Yoast WordPress ...

I am using a calendar plugin. I have been using form data to create a new custom post type of calendar plugin and then update post meta custom fields for that calendar plugin. This works. However ...

I'm using the plugin homepage control in many projects and really like what it does. I can create custom sections for my static homepage and can sort them in the customizer. In my recent client ...

I'm currently trying to update a post's meta value within the save_post action. The problem with this is that it gets overwritten immediately. I've been banging my head on this problem for several ...

Is there a possibility to disable the email field on WooCommerce customer account details? Or Is there a hook or action available to do such thing? I'm just using a pre-made themes and not that much ...

I'm creating a child theme from Storefront. Now I want to remove these action in child theme add_action( 'woocommerce_before_shop_loop','storefront_sorting_wrapper',9 ); by this function: ...

Just have a query reference the add_filter() function. Can you use this function inside a WordPress widget class. Example I have a widget with dynamic created code that I want to pass to another ...

How do I wrap a div around the actions in the code below? PHP in functions.php file: remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); add_action( '...

How to check if an action is already fired in a function for example: function foo() { // checking if the action 'wp' is fired if( !action_fired('wp') ) { trigger_error('invalid call'); ...

I am modifying the query for custom archive pages. I am using the pre_get_posts action. I need to catch some GET variables to modify my query. It is working great on the archive page for one custom ...

I want to run a custom function whenever posts are imported to my custom post type. I am currently running this code - function on_post_import($post){ global $wpdb; $results = $wpdb->...

Its been 3 days now I am fighting to resolve the issue here: An action hook where a comment meta is updated I am pretty sure, even if I am a beginner, that the hook update_comment_meta doesnt exist,...

I am trying to create a hook that when a user login, it check the user role.. if the user role is jsa_contributor then it redirect into specific page. but it seems my code didn't work. This is the ...

I'm learning to create a WP plugin as a class. However, it seems the add_action doesn't work when calling my function; it works when using $this->init(). Example: class test { public $age = ...

I'm trying to debug a plugin which I didn't develop and I want to list all the registered actions. I've read this SO thread: WordPress: How do I get all the registered functions for 'the_content' ...

add_action reference a class

7 answers, 39.495 views actions
Is it possible to reference a class instead of a function in 'add_action'? Can't seem to figure it out. Here is just a basic example of the function in question. add_action( 'admin_init', 'MyClass' );...

i have sample wordpress plugin class. Im hooking woocommerce woocommerce_saved_order_items and i want create a admin notice. Add action from __construct works, but when i want create a notice in hook ...

I am trying to redirect the user after form submission using wp_redirect() but it it is not working. I am submitting data using init action hook. here is the code. function ...

I am using wordpress ajax login without a plugin. I want to not be allowed users access to the WordPress profile after login, Because i have designed a specific profile in the link: http://www....

I am trying to use the action hooks delete_term and delete_$taxonomy, among other hooks that delete a term, but they are presenting the same issue. For example, 1234 is an existing term in the ...

Is there a way to change the meta tags not in the head but in a template file through code? I would like to change the meta tags <meta property="og:title" content="title" /> <meta ...

This question might be wrong, I am not sure about it. Because I am not clear on this. I know add_action it is used to to hook our function to the specified function. For example add_action('wp_head'.'...

I am trying to add action hook in functions.php only if the page is home.php but the following does not work if ( is_page_template("home.php") ) { // do stuff } To make sure that file being used ...

I've tried almost anything and just can't get this to work. I have a custom post type with a custom meta field and I want a default value to be added on when the Publish/Update/Save button is pressed....

I have a plugin and I would like to be able to run the post content through some filters before it is saved to the database. From looking at the plugin api, I see that two hooks that look like they ...

I'm trying to add a button to the single product short description which opens a modal (using jquery modal) The issue I have is only applicable to Composite Products, for Variable products and Simple ...

I'm trying to use add_action to add HTML output to a plugin's front end area, Below is the snippet from plugin <ul class="dashboard-links"> <li><a href="<?php echo $...

Wordpress 4.9.5 I am work on demo to check after login call some action or function, so that i prepare one plugin. Here is the code. <?php /* Plugin Name: Test Login Plugin URI: http://wordpress....

I'm using Zapier to automate the posting of a Wordpress page based on an outside trigger, and I would like to have Wordpress update an existing post if the title matches an existing post title or add ...

In what order/sequence do add_action hooks execute? i.e. init wp_head wp_footer after_theme_setup etc... ??? ??? ??? EDIT: I've also posted my solution.

I'm trying to pass an argument in to the 'init' hook (please see below for what I'm trying to do). //define post type name $pt_name = 'post'; //remove default wysiwyg editor add_action('init', ...

I want to disable access to some pages like "Themes" or "Plugins" for my client (just his ID) and try to do it in the functions.php with this script: EDIT : WORKING CODE : function hide_menu() { ...

got a question about allowing empty comments with worpdress v.4.4.1 to achieve this i use the action 'pre_comment_on_post'. in WP 4.3.1 i could do this easily: if (isset($_POST['comment']) &&...

To hook my plugin content into anywhere, suppose I offered the theme developers to create their own hooks with a prefix (pre_) anywhere in their theme - the rest of the hook is unknown to me. So what ...

My question is how do I remove the action hook in the parent from the child theme? Code from my parent theme: if ( ! function_exists( 'wm_menu_social' ) ) { function wm_menu_social() { ...

I tried searching but I can't seem to find a similar question so I am hoping that as an amateur, I am just making a big simple mistake. What I want I want to install Font Awesome to my WordPress ...

I have a landing page that has to be somehow converted into wordpress theme. And what I want to do is to make an admin page with editable fields that will correspond to the content on the front end. ...

There's a class in parent's theme includes folder which adds action i want to remove in the child theme functions.php or in the plugin class A { public function __construct() { ... ...

Related tags

Hot questions

Language

Popular Tags