People who code: we want your input. Take the Survey

Questions tagged [actions]

A name for an event that is executed at specific points throughout the WordPress core.

Filter by
Sorted by
Tagged with
0
votes
1answer
21 views

Hook that specifies an action code is only applied to a certain product category slug or product ID number [closed]

I have some code running globally on my website that places a notation between my product variation and the add to cart button, however, I do not want it to appear globally, but rather only applied to ...
1
vote
1answer
47 views

Can the wp_filter object hold multiple values with the same key

I'm trying to understand the internals of the $wp_filter object and I'm looking at the code posted by Fuxia in this question How to know what functions are hooked to an action/filter? function ...
0
votes
0answers
16 views

Adding link options in insert/edit link dialog window

Good afternoon! I am looking for a way to insert a text box inside this insert/edit link dialog window. Due to googles recent changes for rel/nofollow links, we would like to insert an option to add a ...
1
vote
0answers
31 views

Gutenberg - Dispatch action or setAttributes() on Post Save/Update action instead of onChange listener

I have a requirement to add up to 8 user selected custom colors to the list of default options when using the Colour Palette. I have registered a meta that saves custom colours. Problem: I want to ...
0
votes
0answers
17 views

Add Tag to post after publishing

I want to add a specific tag to posts being published, I tried the following code and searched for answers here but it doesn't work. Does anyone have an idea why? function tag_to_published_post( $...
0
votes
0answers
24 views

Action Scheduler: Scheduling actions via loop, only the first action successfully executes the function

Anyone use the Action Scheduler API? I am essentially looping and generating scheduled actions. That is all fine and dandy. The first action scheduled is called and the function is executed. However, ...
0
votes
1answer
74 views

Dequeue styles with query doesn't work

In my theme there is the following code (that is printing some inline css on the head of my site) final class Design_Scheme { /** * Design_Scheme constructor. */ private function __construct() { ...
0
votes
1answer
23 views

remove an action hook function on a plugin from a theme

first I did my homework by checking the answer on this question and this question, both didn't work. after long debuging the function I want to remove is protected in 2 nested classes, and follows ...
0
votes
1answer
10 views

How can I specify the post status of an untrashed post?

By default Wordpress assigns the draft status to a post that has been untrashed. I would like to assign the pending status to posts that are untrashed. This seems to be possible with ...
0
votes
0answers
15 views

How can Use custom input field in functions.php page?

I have if clause to add action in functions.php page. But I want to give condition value from dashboard as a custom input instead of defining it functions.php. When I am trying 'echo get_field('...
0
votes
0answers
19 views

user_register is having empty first name and last name

I am using the wordpress : User registration plugin. When users register using the form it adds the first name as well. but while using the add_action user_register the first name is always empty. ...
0
votes
1answer
28 views

update_option_{$option} not working (do function after options are saved)

Below is my code for a simple plugin settings page. It works and saves an option ("EN", "CZ"). However, what I intend to do is run a function after the options get saved (see at ...
0
votes
1answer
20 views

How can I collect and output all attributes of all executed ShortCodes?

I would like to collect all attributes of the shortcodes that are stored in a page in the ShortCodes and then output them all. I do these in a Plugin. 1.) Set a global Variable in init.php ==> $...
0
votes
0answers
14 views

Update a custom role with new capabilities

I have created a custom user role for a site where the role can do almost anything an administrator can do minus a few capabilities like: -Update, Delete, Upload plugins -Change, Delete, Upload Themes,...
0
votes
0answers
14 views

How can I stop ActionScheduler recurring task running after 5 runs?

I am using the ActionScheduler library from WooCommerce as_schedule_recurring_action() function, and am trying to find a way to stop recurring tasks running after 5 runs. I have not seen any parameter ...
0
votes
1answer
19 views

remove_action: how to access to a method in an child class?

I've this in my main plugin file: $main_admin_class = new MainAdminClass(); $main_admin_class->init(); MainAdminClass has this code: class MainAdminClass { public function init() { $...
0
votes
1answer
21 views

I would like to send a notification email (Asana) whenever something is published (posts, pages, custom post types) [duplicate]

The code below works perfectly When I create a new post, an email is sent out to the email included in the function. I would like to know how I can send an email when anything is published on the ...
-1
votes
1answer
20 views

Remove action of an external plugin after checking if custom post meta is set

Edit:The problem were 2 folds - somehow the order list I found before indicated wp_head was before wp_enqueue_scripts but that is not the case. Found another more updated one and it is actually right ...
0
votes
1answer
23 views

default post thumbnail and category if there is no thumbnail and category

I want to do following... 1 - Publish the new post, 2 - Check if this new post has a featured image, 3 - If it has not a featured image, define its category and save the specific prepared image as the ...
1
vote
1answer
25 views

Custom HTML in specific category single page and its descendant categories

I am trying to insert a "style" in single page of a category and its child categories. .relatednews{display:none}. I inserted the following code in functions.php of Child Theme, but it didn'...
0
votes
0answers
26 views

How to redirect a unique link based on login status

I have webstore on woocommerce, and on one of my wordpress pages (that page is not woocommerce page, but just wordpress and it is edited by Colibri free theme) I have download links for some products. ...
0
votes
1answer
15 views

Gravity Forms parameters return 1

I'm not sure what's causing gravity forms $entry and $form parameters to return 1. Here is my class. namespace GrvityFormsIntegration\DataTools; ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' ); ...
3
votes
2answers
133 views

How to check if which hook triggered the call to a function?

I have a situation where I have a function hooked to more than one custom hooks. How to check in the callback function which custom hook triggered the call? Or the question in code will be add_action('...
0
votes
1answer
14 views

Nested “do” and “add” Actions is possible?

I'm wondering Questions were asked about more than one "add_action" and filter nested before and it was deemed possible. Are nested cross actions added? Eg. add_action('init', function(){ ...
5
votes
1answer
197 views

Do WordPress' cron's clean up expired transients?

WordPress has a cron named "delete_expired_transients" as seen in the image below. In this way, does it clean expired transients daily? Or is it just giving us action? Should we clean it ...
2
votes
2answers
148 views

Hooking new functions to actions + passing parameters

I am trying to understand some fundamentals of php with regards to adding new functions to actions. I found a tutorial where he adds a new function to the save_post action… add_action('save_post', '...
0
votes
0answers
24 views

Update user role after Memberpress transaction

Currently working on a Memberpress site that offers courses for a monthly subscription. Certain user actions on the site will update their role. I'm looking for a solution for reset the role back to ...
0
votes
1answer
43 views

remove_action from parent theme using child theme functions.php

I am trying to remove an action from the parent theme header but I am still not getting any success, here is the class <?php class theme_Header_Layout{ public function __construct() { ...
0
votes
0answers
33 views

Struggling with plugin dev basics: add_action

I've done a lot of reading, but I'm just really struggling to get my head around it. I am trying to write a plugin that catches User Registrations/Password changes/deletion and subsequently update a ...
0
votes
0answers
19 views

Wrong to use echo in wp_footer

I have a feeling that my code is causing the following error: PHP Warning: Cannot modify header information - headers already sent by (output started at /public_html/MY-WEBSITE/wp-content/plugins/...
1
vote
1answer
36 views

WP CLI Get all Enqueued Scripts and Styles

Normally, I would hook into the wp_enqueue_scripts action in order to gather a list of enqueue'd scripts and styles. However, I have a very intensive process I need to run, thus instead of running it ...
0
votes
1answer
55 views

RTrouble passing arguments to action

I know there are several posts on this topic. I have followed many of them as well as other resources on the web and thought I had it down, but it does not seem to be working. In my case, I have 2 ...
0
votes
1answer
18 views

How to hook add_action() into after category description with id?

I'm using newspaper theme for my web blog. I want to create post highlight into certain category. For example in this url: https://blog.bookingtogo.com/category/destinasi/wisata-domestik/pulau-bali/ I ...
0
votes
0answers
23 views

Wordpress: add custom bulk action to Flamingo

I am trying to add in a website a simple support ticket function using contact form 7 and Flamingo. On the Flamingo admin entries page I need to add a new column (status) and new bulk actions (open, ...
0
votes
1answer
33 views

Callback hooked to post_updated firing on new posts as well

Context: I'm using a plugin that allows me to add author boxes throughout my site (Simple Author Box), while providing an easy way for any user to update their social media links and profile pictures. ...
0
votes
1answer
156 views

Add and Remove Row Actions in an Existing WP_List_Table

I would like to modify the row actions of an existing WP_List_Table. For example, in the Users section in the back end, I would like to remove the "Edit" option from each user. I would like ...
1
vote
1answer
17 views

Stopping user deletion from running on error

I am writing the following code to do some cleanup before deleting a user via the admin area function delete_user_custom_data ($user_id) { $result = do_some_cleanp($user_id); // The ...
0
votes
1answer
16 views

Query Nopaging action not having effect

I've got a custom loop function in my child theme, in the templates.php file to loop through specific post types ('listings') and then put it into an array to use into a part of my template. Here's an ...
0
votes
0answers
15 views

WP Customizer - How to change theme mod with live preview? When using `remove_action()`

I've made a theme customizer setting that hides the meta data on a single woocommerce product page. When I save the setting and go out of the customizer I can see the setting takes effect. So that ...
0
votes
0answers
27 views

Run a function when a custom post is update?

There is a custom post type. Each post has a repeater field. When a post is updated, I need to get a value from the repeater field and insert it into a custom table in the WordPress database. To do ...
0
votes
0answers
33 views

Issue passing action class to nested function. Admin Columns

Trying to run the same function for multiple actions. I've got it working for ACF, but the Admin Columns action has a class, and I think that's where I'm struggling, though I'm not sure. //Works: ...
0
votes
1answer
30 views

Two functions with different arguments and add_actions, but identical code

I feel like this is simple. I have two functions that contain identical code, but need to have different add_actions and arguments. There's got to be a way to do this so I'm not copying and pasting ...
0
votes
0answers
10 views

What hook do I need to save a setting?

I've added a new field onto the discussion's section on the /wp-admin/options-discussion.php page that outputs along with this: <?php do_settings_sections('discussion'); ?> How can I hook the ...
0
votes
0answers
10 views

Best way to figure out in code if I am in a new post or exiting post

I am using ACF and and ACFBuilder to create all the fields for my content post. The code that creates the field is hooked to the acf/init action. When I am creating and adding these fields, I need to ...
0
votes
1answer
28 views

Hook to change the site URL

I am working on a WP system that is supposed to be served by multiple domains. For example, foo.example.com and elpmaxe.com point to the same installation. But depending on the URL, the system will ...
0
votes
1answer
33 views

Assign user role by text field in Wordpress (Woocommerce) [closed]

I have a virtual store with woocommerce where I use the USER REGISTRATION plugin to register new customers. This plugin allows the creation of custom fields. I created a custom text field called "...
1
vote
0answers
48 views

Shortcodes — Using add_action, add_filter in the shortcode

A client wants the following: User clicks on a specific button which takes them to a partner's site. If this is their first time clicking the link, they need to accept terms and conditions. If they'...
0
votes
1answer
24 views

Is it possible to make get variable out of filter in Class?

I am trying to have a variable out of the filter At the end of there is return apply_filters( 'woocommerce_account_menu_items', $items, $endpoints ); function wc_get_account_menu_items() { $...
0
votes
0answers
21 views

Remove action that incudes external class

I'm attempting to achieve something similar to the following question, but I'm having difficulty attaining the desired result - Remove an action from an external Class The Wordpress theme Neve is ...
0
votes
0answers
8 views

How many times should a block's edit be being called?

It feels like the answer should be once, or maybe once per instance of the block on a post/page. I'm writing a new block, and for debugging purposes, I'm logging the post_id very early in my block's ...

1
2 3 4 5
28