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.

0
votes
0answers
10 views

How Regenerate CSS (clear cache) with Elementor after WP Migrate DB Pro migration [on hold]

I want to call Elementors "Regenerate CSS" feature after I run WP Migrate DB Pro. Elementor's Regenerate CSS function is tied to its clear_cache function: https://code.elementor.com/methods/...
0
votes
1answer
25 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
30 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: ...
0
votes
0answers
15 views

change author of a woocommerce product

I'm trying to change the ID of 'post_author' of 'shop_order' post type in wordpress-woocommerce. So here is what I'm trying to do: When a customer is buying a product with the product Id of 356, I ...
1
vote
2answers
36 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) ...
0
votes
1answer
23 views

woocommerce_order_status_completed Not being called

I have developed a custom plugin that is overall working great. No errors by WP or SQL problems as it access a custom database. BUT, for the life of me, I can not get the woocommerce call back to ...
2
votes
2answers
113 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
12 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
29 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
51 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
26 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
18 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
16 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 ...
0
votes
1answer
45 views

Woocommerce - display custom billing field in user edit page (user-edit.php) [on hold]

I created several custom billing fields, correctly populated when the user checkouts. I could show them ( view/edit them ) in every section of woocommerce, but definitely i cannot show them in the ...
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
25 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
9 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
170 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
11 views

Is there an after or before_remove_product_image hook? [on hold]

I am using WooCommerce and want to change some custom meta for the product thumbnail when it is unattached, so I searched everywhere for an action that fires when you "remove product image", or ...
0
votes
0answers
43 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
24 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
21 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
14 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
36 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
21 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
15 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 ...
0
votes
1answer
24 views

Posts feed number of posts

Happy Holidays everyone! I hope you can help me with this 'little' problem I'm having :) I am using a child theme based on Elara which displays the posts feed in different formats on the front page ...
0
votes
1answer
32 views

How to check, if user commented before, on comment_post action?

I want check, if user commented post, in comment_post action. So i make this: function checkUserComment( $comment_ID ) { $comment = get_comment( $comment_ID ); $postID = $comment->...
0
votes
2answers
53 views

Remove actions/filters that are set with create_function()

This theme I was handed from another dev company is littered with add_action/filter( 'hook/filter', create_function( '', 'return blah('blah')' ); We will be moving this site to a server running php 7....
0
votes
1answer
16 views

add_action not calling back to function

I am working on a plugin, but add_action doesn't call the callback. The code is as follows: require plugin_dir_path( __FILE__ ) . 'includes/class-network.php'; $distro = new Classnetwork(); ...
0
votes
0answers
13 views

Add to edit edit user profile page, above the edit_user_profile hook

I want to add to the edit user page (for admins) but the action hook edit_user_profile shows up quite low in the page. Is there a way to get this up higher? I've been unlucky searching for this so ...
0
votes
0answers
14 views

in the post admin, is it possible to make the post title input disabled using php?

I am customising my product post type and auto generating the post title using add_action('acf/save_post'). See my php below for this... class Product { /** * product constructor method. ...
1
vote
0answers
13 views

How to properly modify WP Vary or any existing headers?

I have a site that currently have a some part of the headers like: Vary: Accept-Encoding, Cookie I want to modify it to be: Vary: Accept-Language I tried the suggestions here using this code ...
0
votes
0answers
26 views

Remove action hook from Class, understanding OOP

I am trying to remove an action that is within a class, of the parent theme. I made an example of the code I have, below. I am trying to remove the action in the child theme functions.php. I've tried ...
0
votes
1answer
17 views

How can I locate where the actions are defined? [duplicate]

Given the following code: <form> <h1> My form <h1> <input type="text" /> <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?> </form> ...
-1
votes
1answer
71 views

Cannot modify header information - headers already sent

So I have a form on one page, which is submitting to admin-post.php, then there is a function in functions.php which is processing the form. It stores the input field data to database and then after ...
4
votes
1answer
190 views

How do I enqueue a script to run inside the Gutenberg editor?

I'm using the Gutenberg editor as a replacement for a whiteboard in a classroom. I'm able to make the classroom more interactive by having students work directly inside the Gutenberg editor. As a long-...
0
votes
0answers
57 views

Can run cron event manually with WP-CLI but not with any plugin, unsure if it's being scheduled

I have a cron event that I am able to manually run with wp cron event run --all When I go to my dashboard and go to WP-Crontrol OR Advanced Cron Manager, I can see my event listed and tell it to ...
0
votes
0answers
21 views

What is the recommended way to save errors / warnings / user messages from actions / filters for custom display in the frontend?

This is a very basic question and there are a lot of solutions to it - however what is the recommended (or at least a good) way? Problem statement: While processing a request to a WordPress project ...
3
votes
1answer
37 views

Restrict access to admin but allow admin_post hook

I'm using this hook to allow only admin roles access dashboard add_action( 'admin_init', function() { if ( defined('DOING_AJAX') && DOING_AJAX ) { return; } if ( !...
0
votes
1answer
22 views

Does anybody know what the $current_screen ->id for customizer.php is?

I searched high and low & tried a bunch of different things but I still wasn't able to add inline css to the customizer.php page. I usually employ page id $current_screen ->id === " " for ...
0
votes
0answers
9 views

On opening Edit New Post, insert something in editor [duplicate]

I would like to automatically insert a shortcode every time one opens the editor for creating a new post, for a particular post type. So that the editor is pre-populated. It shouldn't happen for ...
0
votes
3answers
493 views

Ajax call to php function doesn't work PHP code

I have a form like this: <form method="post" action="" id="BookingForm"> <label for="email">Email</label> <input type="text" name="email" id="emailId" value="" /> &...
-1
votes
2answers
49 views

Using add action for class with construct

i have this i answer in reference but seems have upvoted by many https://wordpress.stackexchange.com/a/48094/145078 but not sure why it is not working for me.. in answer class MyClass { ...
1
vote
1answer
33 views

Use debugging for add action events

Is it possible to vardump the variable inside the action function? i am not able to echo or see results when i am doing so. This is not a woo commerce question but i am having problems with ...
0
votes
0answers
15 views

Intercept password prior to wp_update_user committing and hashing?

I'm using a plugin that uses wp_update_user instead of password_reset and I need to use the password prior to hashing to sync the change to a secondary authentication system. Is there any way to do ...
0
votes
1answer
30 views

Hook into all password resets in Wordpress and get password before hashing?

I'm syncing my Wordpress authentication system with an secondary/external authentication system and my site has at least two ways of resetting the password, including: Password reset email User ...
0
votes
1answer
20 views

Add Action wp_update_post not Updating WYSWIAG editor

When we use the wp_update_post function, and do a pre_post_update action, it gets updated in the database, but the WYSWIAG editor shows the revision just made, not the processed one. For example ...