Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [actions]

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

1
vote
0answers
6 views

How to handle custom wp list table bulk actions

I'm using the wp_list_table class for my plugins and still wondering how to handle bulk actions out of the class file as best. I found here that you should do it like this: So the flow is like this: ...
4
votes
1answer
25 views

What is the earliest possible hook for safely using `is_front_page`?

When a page request is made, at what point does is_front_page start working? As I recall, if you try using it too early it will always return false. My assumption is that the wp action is the first ...
0
votes
0answers
13 views

profile_update hook does not fire from front-end

I'm using BuddyPress to allow users to log in on the Front end. Once logged in, they can click on 'My Account'. On this page they can upload avatars, edit their account information, etc. When I ...
1
vote
0answers
12 views

Save acf field data via acf/save_post before post is saved

I have 4 advanced custom fields and I would like to save each field value when it is changed on the post and not have to wait until the post is saved. I'm using acf/save_post action. Here is my code ...
1
vote
1answer
44 views

Remove action on product archive page [on hold]

I have a product description which is hooked into my product archive page in the following way by my theme (The7): /** * display short desc hook. * * @hooked woocommerce_template_loop_rating - 5 *...
0
votes
0answers
29 views

a weird attribute on every html tag

me and my friend working on a Wordpress site but we see it differently on our machines, He sees a weird attribute wfd-id="" on every html tag in google console when he inspect it, also I loaded ...
0
votes
2answers
20 views

How to pass argument to add_action while the method is inside a class?

in my functions.php I have require 'autoloader.php'; add_action('init', 'MyClass::make'); and in my MyClass class I have class MyClass { public static function make($type) { var_dump($...
1
vote
1answer
13 views

How to Use Parameters with a Do_Action Function Within PHP Tags

I'm using a WordPress plugin that allows integration actions to integrate it within a theme. Using GeneratePress' Elements feature, I'm adding the action as a hook. Currently the code I'm using is: &...
-1
votes
1answer
27 views

password_reset doesnt work

Im trying to use $_POST method after password reset submit action here is the code add_action( 'after_password_reset', 'action_function', 10, 2 ); function action_function( $user, $new_pass ){ if ...
0
votes
1answer
23 views

Which hook should I use to capture $_POST('password') via profile update and password reset

I need to rehash the password which the user entered during Wordpress registration (I use WooCommerce) I'm successfully able to do this with the following: add_action( 'user_register', '...
0
votes
1answer
30 views

WordPress ajax-action how to return content

So I'm trying to set up an AJAX action for a plugin I'm building. When using /wp-admin/admin-ajax.php?action=beacon_podio-get_apps I was just getting hello world0 and I'm not seeing Request is ...
0
votes
3answers
28 views

add_action where function has arguments

I have a general question about functions and add_action to it. I have a function and adding an action do it. But how can i define a value for the argument on this action? add_action( '...
0
votes
0answers
11 views

Can we execute a function when Gutenberg block is added?

I'm wondering if there is a way to execute a function when a certain block is added in the editor, but not each time we edit the block. As far as I know the only functions we can specify are edit and ...
0
votes
2answers
41 views

Add HTML code before the title of the Tag page

I want to show an iframe at the top of a specific Tag page, so once I have is_tag('my_tag'), I will add the iframe before the title of the page. I've tried this code to show the iframe before the ...
0
votes
0answers
13 views

Button bulk action

Hi! When i press myAction button i want to trigger an action from bulk drop down.Can someone help me? Thanks in advance!
3
votes
1answer
26 views

How to show more posts on an archive page?

I'd like to show more posts on my custom archive page, but can't seem to figure out the right way to do it. Currently it displays 10, which is the number set in WP Settings and the number I'd like on ...
0
votes
2answers
39 views

How to run a function after wp() in the wp-blog-header.php file?

I want to run a function after the wp(); line in the file wp-blog-header.php, what is the proper hook to use here? <?php /** * Loads the WordPress environment and template. * * @package ...
2
votes
2answers
35 views

Unable to show error message using wp_login action

My goal is to show an error message when i check if the user is locked or not, the problem is that when the function ends, it redirects to the page that must appear after succesfull login. Objectives:...
0
votes
2answers
24 views

How to call a function or method that is Namespaced using another plugin

I'm using an action from one plugin that needs to call a function from another plugin. That function is name spaced. Typically, I would use something like: add_action( 'hook_name', 'function_name' );...
0
votes
0answers
70 views

Is there a way to disable ajax add to cart for specific products on single product pages

I would like to disable ajax add to cart for specific products, products that have add on's enabled by the Woocommerce product add on plugin as ajax add to cart is not compatible with products using ...
2
votes
2answers
36 views

Fire jQuery function when post edit screen loads

Trying to get this function to work. But keep getting a jQuery not defined error. I have tried many variations here to get the jQuery to work: https://blog.templatetoaster.com/fix-jquery-is-not-...
0
votes
0answers
21 views

WordPress Plugin Boilerplate - add actions and/or filters based on user's role

I am developing a plugin using WordPress Plugin Boilerplate. Some of its functionality need to be available only when a shortcode gets resolved in a page and furthermore some of it only if a user is ...
0
votes
1answer
38 views

Get post content inside plugin class method

I'm writing a simple SEO class that will add the various metatag to the header of wordpress. I've two little problems with the wordpress api. The first is that I need to remove the last comma from ...
0
votes
2answers
17 views

add_action( 'publish_pelicula', 'post_published_notification', 10, 2 ); does not trigger propperly

I'm trying to send an Email before a post "type:pelicula" is submited, but it does not enter to the function post_published_notification, here is the code: <?php /** * Plugin Name: VRlife Alertas ...
0
votes
1answer
14 views

Ajax call works for logged in users and returns “Bad Request” for guests [duplicate]

I have a WordPress site that uses ajax to submit a form on the Front-end. When the form is submitted by a logged-in user, all works fine. When the form is submitted by not-logged-in user, I get a "...
0
votes
1answer
22 views

Its possible to ajax update the content of the admin custom post type list

I have a CPT list in the admin area.. and have two columns with checkboxes thats toggle the post status between publish/pending by ajax.. Is there any code or action fired by ajax to refresh the ...
0
votes
1answer
19 views

Load actions and filters only for the admin CPT list

I'm developing a wordpress plugin, and I have a trouble that I can´t resolve for myself. Im trying to load some actions and filters only when the CPT admin list was loaded I have the following code: ...
0
votes
1answer
39 views

How can I output all apply_filters and do_action?

I would like to output all apply_filters and do_action to give the user an overview of them. If I use the Code add_filter( 'wpErpOs_testFilter', 'wpErpOs_testFilter_callback', 10, 1 ); function ...
0
votes
1answer
36 views

use add_action in a shortcode (gravity form - Wordpress)

I have a shortcode. With this one, i get the ID (number) of a formular $num_formular. Then, with this one, i had to send all the data in the database. When I run the following code, it works: ...
1
vote
2answers
107 views

Custom post type archive sorted and grouped by date in post meta field

I am trying to build an Custom Post Type for showing information about events. The Custom Post Type has name 'Event', with the following meta fields: event_startdate (date in format YYYY-MM-DD) ...
2
votes
2answers
149 views

RSS feed with specific keyword

I am able to get articles as RSS feed from below url http://wordpress_site/blog/feed I am also able to get articles from BlogSpot with specific keywords as below https://www.yourblogname.blogspot....
1
vote
1answer
13 views

Are the hooks in the dashboard such as “load-$page_slug$” and “admin-head-$page_slug$” reliable and consistent throughout installs?

I've created a page using add_theme_page with the name of access_page. Whenever someone accesses that page, or rather, for that page, a few hooks are created, such as admin-head-access_page and load-...
1
vote
1answer
38 views

Delay an action until current action is completed

I have two actions that run when a post is updated. The issue is, the second function runs before the first has completed. add_action('save_post', 'postUpdate', 10); add_action('post_updated', ‘...
0
votes
0answers
55 views

wp_footer hook causing text to show on bottom of page

The below function is causing the resulting options to display on the bottom of the page (under the footer area) when the search bar is activated / being used. Oddly enough, it seems like this is by ...
0
votes
1answer
49 views

Create post revision on slug change

I'd like to be able to track changes in the slug / post_name field of the post. I've tried using wp_save_post_revision(...); if I detect a slug change, but according to this page wordpress only ...
0
votes
1answer
33 views

Check if `do_action()` in WordPress returns any result

I want to check if do_action('some_hook') in WordPress returns/echoes any result for a specific post. I've tried using has_action('some_hook') but it only checks if 'some_hook' has any registered ...
0
votes
0answers
19 views

do_action from within a class does not seem to work

I have a class within a plugin which is loaded via the below code: <?php add_action( 'plugins_loaded', array ( 'Company_Store_Locator', 'init' ) ); class Company_Store_Locator{ public ...
1
vote
1answer
18 views

CampaignMonitor for WooCommerce - Move subscribe button [closed]

So I need to move the checkbox provided by CampaignMonitor for WooCommerce to a different part of the checkout screen. I've already managed to copy it to the right place via add_action( '...
0
votes
2answers
39 views

Display attribute on shop page after the title

I am using the following code for displaying a custom attribute on the Woocommerce shop page. But for some reason, the year is displayed above the product image instead of after the product title (In ...
0
votes
0answers
10 views

Execute my Custom Plugin's function in WP Admin

So I am developing this wordpress plugin for WP Admin. I am able to call different views and function by using this URL structure. /wp-admin/admin.php?page=imported_isbns_list and it executes the ...
3
votes
2answers
233 views

Are 'wp_ajax' and 'wp_ajax_nopriv' exclusive to authenticated and non-authenticated users?

Basically what I'm asking is, is wp_ajax_nopriv exclusive to non-logged-in users? Will a wp_ajax_nopriv action fire if a user is logged in?
0
votes
0answers
21 views

Create new meta field with existing field data on publish

I am using a frontend publish plugin that uses Wordpress's default publishing hooks to publish, and I am trying to create a function that will grab the data of one of the fields in the frontend form, ...
0
votes
0answers
74 views

Woocommerce: Update SKU after add to cart button

Some products have the standard SKU (inventory) field from woocommerce (SKU1) and an extra SKU (sku2) custom field. I added a mandatory selection box: "With barcode", "without barcode", if the user ...
0
votes
0answers
35 views

Set global $wp_query/$post variable for dynamic page generation

This is a difficult one to describe, but I'll do my best... I'm trying to set up pages that can be shown based on a second (meta/ACF) slug, dependent on the language the user is using. Essentially, I ...
0
votes
0answers
37 views

How to override parent theme actions

Working on a child theme. On the parent theme functions.php there is a 'widgets_init' action where four sidebars are regsitered. I need to remove three of those sidebars. What is the propper way to ...
0
votes
0answers
17 views

Unable to remove action from parent theme

I have a problem with remove action from parent theme in my child theme. Parent theme code: add_action('custom_action_name', 'function_name', 10); function function_name() { //something } Child ...
1
vote
3answers
37 views

How do action and filter hooks understand where to look for the core function that we hooked our function to them

I want to know how does WordPress core files handle the relationship between module and core of the WordPress? We all know it uses add_action() and add_filter() to manipulate data according to our ...
0
votes
1answer
34 views

Change order of custom submenu link in WP Admin?

I've added a custom link to WP Admin under the Users menu, but trouble is I can't seem to get it to display above the default options. Is this possible? My code: // Add sub-menu option to users menu ...
0
votes
1answer
16 views

How to access deleted term inside delete_product_cat action

I want to run some code after a product category is deleted, in that function I want to access the name of the deleted category, and according to their docs I could do this: add_action('...
0
votes
0answers
16 views

Add_filter not return any output in custom plugin

I am using WordPress Boilerplate plugin structure to create a custom plugin.Add_action works but add_filter function not returning any output. Here is my code. includes/class-post-rating.php file ...