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
15 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
19 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
20 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
21 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
21 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
14 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
114 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
175 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
137 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
18 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
41 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
28 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
17 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
32 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
51 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
17 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
18 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
30 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
57 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
25 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
26 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
9 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
17 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
28 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
40 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
22 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
17 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 ...
0
votes
0answers
12 views

Run function on Add new post button

I have a php function for populating some fields on the edit post page. I want to run this function when the user clicks the Add New button on posts page. Or maybe create a new button to run my ...
0
votes
1answer
40 views

Does hook have an effect on increasing the page load?

I have a personal website which uses WordPress. for same changes on the theme, I can add manually codes on single.php. Or I can write a hook for it. for example, I want to add content on a specific ...
0
votes
1answer
37 views

Combine one action and one filter

I want to show an error message in Woocommerce checkout page, and remove the order button. I can use one action and one filter: add_action( 'woocommerce_before_checkout_form', 'add_checkout_error', 9 )...
0
votes
1answer
23 views

Use PHP Class in Wordpress functions

I have a class that I want to use in functions.php but I'm not sure the best way to set it up I also want to get WooCommerce's cart array. I currently do not have access to WC() in my class yet. What ...
0
votes
0answers
26 views

Hide products based on user role and category

I'm working with Wordpress and Woocommerce and I'd like to hide all products with a certain category from all users, except users that has a special role. For example, let's say I have a category ...
0
votes
0answers
145 views

How to run an ajax call in elementor editor

I am having a strange issue. I am not able to execute an ajax call while in Elementor edit mode. add_action( 'wp_ajax_slug_configureheader', [ $this, 'rename_configureheader_callback' ] ); add_action( ...
0
votes
0answers
7 views

Customize (or create) the Add new post button

I am writing a plugin and I want to customize the add new post button (or create a new button) so that it can create a new post with some values prefilled based on the url. Is it possible?
1
vote
0answers
25 views

Prefixing plugin hooks (actions/filters) with a wrapper class or functions

I'm developing a rather extensive plugin which has a lot of hooks that are prefixed with the plugin namespace. I have created a wrapper class like the one below but because this plugin is geared ...
0
votes
1answer
12 views

Why do actions with class and public method don't fire __construct()

I'm trying to understand how WordPress works with actions, classes, and methods. If there is a class "TestClass" and it has a public method 'method1' The method can be hooked to any action ...
0
votes
0answers
16 views

Change or rewrite add to cart button functionality "

After clicking add to cart button by a user than i want to show checkout page in a popup instead of redirecting to cart, checkout pages. My purpose is to show checkout page in a popup after clicking ...
0
votes
0answers
12 views

Order category in shop page

i have this function to order for category the shop page in woocomerce function so_27975262_product_query( $q ){ //$q->set( 'category__in', array(96,105,97) ); if( !is_product_category() ) { ...
0
votes
1answer
38 views

do_action won't work in ajax callback

I want to perform some actions when ajax tasks done successfully. For instance, if the item added to the cart, I want to send an email. Also may perform a few more actions. Setting up do_action('...
1
vote
0answers
20 views

How to remove action with slashes and arrows?

I have two actions like BSF_AIOSRS_Pro_Markup–>disable_astra_theme_schema and 'Yoast\WP\SEO\Integrations\Front_End\Redirects–>archive_redirect' on 'wp'. But I can't remove these both as usually ...
1
vote
0answers
70 views

Can the wordpress color palettes by changed through Javascript?

I'm building a setup for a client that allows them to use a number of colour swatches throughout their gutenberg blocks in a post. They define the colour swatches in the document inspector panel (post-...
0
votes
1answer
25 views

How to Override Page Template if URL matches query?

I have 4 Page Templates that my theme uses for all the pages - Default Template, Template One, Template Two and Template Three. When the relevant Page Template is selected, it loads an Advanced Custom ...
0
votes
1answer
19 views

Where do I hook to have the server do something in PHP on block attribute change?

I'm creating a new block plugin, and I'd like the server to do some stuff when certain attributes change. I'm thinking I'm looking for something like function my_attribute_changed ( $block_ID, $...

1
2 3 4 5
28