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
12 views

What's the correct way to add capabilites to user roles?

A third-party plugin adds the capability 'edit_booked_appointments'. I'd like to assign this capability to the already existing user role 'editor'. I created the following function in my child theme: ...
0
votes
0answers
5 views

Add User in Admin and Redirect to Edit Profile Page instead of Users List

I'm probably missing something super simple, but how can I redirect the admin user to the edit profile page when they create a new user? I've tried to hook into this: edit_user_created_user and then ...
0
votes
1answer
9 views

How do I dequeue js/css at the last possible moment?

I'm trying to dequeue the font-awesome stylesheet included with the ninja forms plugin (because I manually include the latest FA via a CDN). I did this: add_action('wp_enqueue_scripts', function () {...
0
votes
0answers
14 views

Add extra cost to shipping method itself in woocommerce

I found the following code from this link: https://stackoverflow.com/questions/52138784/add-a-fee-based-on-shipping-method-and-payment-method-in-woocommerce The code works great if you want to add ...
0
votes
1answer
11 views

Get original value in save_post action hooka

I'd like to get the original value of the $post on the save_post action. This way I can detect changes, and only do specific actions if the post content/title was changed. Is this possible?
2
votes
1answer
38 views

Unable to programmatically remove product from WooCommerce cart

I'm using WooCommerce. For certain conditions, I'll want to remove a specific product from the cart. I feel like I'm using the correct method of doing this, but for some reason it's not working. Other ...
0
votes
0answers
32 views

save_post hook is saving value, but it's not there for woocommerce_order_status_completed_notification [closed]

I have added a meta box for my Woocommerce orders with a tracking number and my save_post hook is firing and saving it. My Woocommerce email template gets an empty value the first time when I enter ...
0
votes
0answers
10 views

Is there a way to completely replace the sidebar in the admin panel?

Pretty new at this and was wondering if there is any way of completely replacing the sidebar in the admin panel? I found the hook do_action( '_network_admin_menu' ); but I'm not sure if that is the ...
0
votes
0answers
13 views

WooCommerce Subscriptions on Subscription Product Removal

Currently, I have a custom options page where my client can create "bundles" for subscription products and for those bundles, customers get recurring discounts. I couldn't use the default WooCommerce ...
0
votes
0answers
9 views

How to retrieve Post Author ID And print in CF7 email

I have added two custom functions in my theme to retrieve Author email and Author ID From a specific post where contact form 7 Is displayed. But My Author ID Function is not working and only author ...
0
votes
1answer
12 views

Add back in child theme what the parent theme removed with remove_action

My parent theme removes the emoji fallback script that makes emoji show up as images: // parent theme's functions.php remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('...
1
vote
1answer
11 views

Save User Meta Email Address in Lowercase

I'm looking for a way to save all email addresses to user meta as lowercase, ideally without validating and asking the user to change it but instead just saving it as lowercase. I've got as far as the ...
1
vote
1answer
41 views

How can I add data to a custom column in the Users section of the wordpress backend?

Can anyone help me with adding data to a new User table column that I added? In the wordpress backend, in the Users section, I added a custom column called "Last Name". Now, I'd like to add last ...
2
votes
1answer
58 views

Explanation for remove_filter used in the below code [closed]

I am very confused about what the developer has done here. This is inside a class..a filter has been added and then removed, added again. This code results in many errors as well. add_filter('...
1
vote
0answers
20 views

How do I use remove_action on an add_action that uses an array?

This is a messy question :) I'm running into a conflict between plugins and need to disable one (WP Bakery) on the front end of certain pages. I'm looking at multiple questions on how to disable a ...
1
vote
1answer
32 views

Execute Hook on the footer or header after activating a plugin

I have the following code fraction, but it does not work, I want that after activating a plugin this calls an action on the footer and prints something, but I can't do it, the problem seems that the ...
0
votes
1answer
23 views

Post Click Redirect to Custom URL instead of Single Post Page

I have a custom post type called "articles". When an article link is clicked, I want to redirect them to custom URL(this URL is saved in the database as custom field) instead of the single page. How ...
1
vote
0answers
11 views

A method for ordering mixed dates in search result loop (theory only, no actual code)

My issue Hello, some time ago: I had the regular post and the custom evento post types; the evento post type had a ev_data_out custom field; the search result loop had to return a list of posts from ...
0
votes
0answers
22 views

Overriding Plugin function in your child theme

Plugin actions $this->loader->add_action( 'wp_ajax_woo_amc_get_cart', $plugin_public, 'show_cart_items_html' ); $this->loader->add_action( 'wp_ajax_nopriv_woo_amc_get_cart', $...
1
vote
2answers
35 views

Pros and cons of actions over shortcodes

I need to output some posts on some pages and I created shortcode: function show_foo() { // output stuff } add_shortcode( 'foo', 'show_foo' ); and I use it like this in templates: echo ...
0
votes
0answers
36 views

Using Nested add_action()

I am new in WordPress.I am learning Plugin Development. Is it possible to use Nested add_action() like below ? add_action( 'admin_post_addAddress', 'add_new_address' ); function add_new_address(){ ...
0
votes
0answers
18 views

Trying to add an action to a custom post type

I have a custom post-type that I need to add a two state style button (Complete or Completed) The custom post type is a video so I want the client to be able to complete a workout. I am not super ...
0
votes
0answers
35 views

How to detect first pageload on successful login?

I want to print some JS on my site on the first page load after login - e.g. alert( 'You just logged in!' ); but there doesn't seem to be anything on the page (WooCommerce's /my-account, in this ...
0
votes
1answer
27 views

ajax-action.php can't find added action

Dear fellow Wordpress plugin developers, I'm currently developing a WordPress custom booking plugin. In this plugin, I have added a calendar shortcode, which embeds an Html month calendar on the page....
0
votes
1answer
32 views

How to Unhook actions/filters in within Class in plugin

I have a business website for vacation home rentals in which the WordPress theme has its own booking system for house bookings only and it has been great! I also, have Tour/Services (not Houses) also ...
0
votes
0answers
34 views

Add custom action to the page listing screen

I'm creating functionality that will clone a published page and create a new draft page from the content. I placed an action link alongside the "Edit | Quick Edit | Trash | View" items that appear ...
0
votes
0answers
44 views

Trying to place a custom field after the total section in the checkout page in woocommerce

This code correctly works but does not place the custom field where I want it. In the add_action I would like to use woocommerce_review_order_after_order_total as the location attribute to place it on ...
0
votes
0answers
84 views

Google Gtag or DataLayer Push not working within action hook

I used to use a function just fine but recently, perhaps because I corrected my implementation of Google Tag Manger and perhaps for other reason, I can't seem to use this code which is hooked to a ...
0
votes
0answers
153 views

login_headertitle is deprecated since version 5.2.0

I have an issue my friends. when I got to default logn page in wordpress, I see this error: Notice: login_headertitle is deprecated since version 5.2.0! Use login_headertext instead. Usage of the ...
0
votes
1answer
49 views

Custom query_var to get URL paramater not working

I have a custom Wordpress login and if the user gets to the homepage and is not logged in, they are redirected to the custom login form(I have disabled this for now while I test). What I would like to ...
1
vote
0answers
20 views

How do I add a custom screen for a custom post type to be called from custom post row action?

I have custom post type called messages where I will store emails and my request is very specific. New post cannot be created and user cannot do anything with it except delete it. I have already added ...
0
votes
1answer
29 views

Filter get_page_by_path()

Is there a way to filter get_page_by_path()? I am trying to allow duplicate slugs for pages, so that two pages can have the same slug if they have different meta value for a specific meta key. Thanks ...
0
votes
1answer
32 views

How to add custom checkout field in user details mail template

I need to add custom field from my checkout page to email templates. I already added custom input at checkout page and it shows up in mails but it shows up after products table and I would like it to ...
0
votes
0answers
29 views

wordpress insert post without actions/hooks

I am developing a custom importer for WordPress (because we have a very custom setup and the available tools don't seem to work for our scenario). During this import, I'd like to disable any hooks ...
0
votes
0answers
36 views

Post is uncatagorized in publish_post action

I've added several bits of metadata to my post categories. When that post is published I want to copy some of those meta values into the custom fields of that post. add_action('publish_post','...
0
votes
0answers
31 views

do_action doesn't trigger if it's in a template that gets loaded via REST endpoint

i'm building a single page application using woocommerce and custom REST endpoints to get template parts and load them into the browser ... one endpoint is getting content-single-product.php template ...
0
votes
1answer
43 views

Get_term_meta() does not work with pre_get_posts()

I am trying to get custom term meta value for a certain category using get_term_meta() function. This value is stored in the wp_termmeta table. Then, based on that value, I want to modify the main ...
1
vote
1answer
20 views

Custom post type suppress transition from future to publish

I've scheduled a custom post type to a future datetime. Now I won't that it will be published automatically, instead it should switch the status to draft. We use this to pulish the webinars, so we ...
0
votes
0answers
57 views

WPML - Hook when language is switched (change user language)

I would like to change the logged in user's language (if someone is logged in) when they change the language in front-end. I'm using the WPML Multilingual CMS plugin in my Wordpress website. I've ...
1
vote
1answer
78 views

Wordpress action admin_post for non-admin authenticated users - Form submission

I'm trying to submit form using: `admin_post` && `admin_post_nopriv` actions. This is a shortcode for users search: add_shortcode( 'search_users', 'search_users' ); function search_users( $...
0
votes
1answer
32 views

Is it possible to apply_filter on a wp_ajax_ action?

I'm extending someone else's plugin with an AddOn and register it on their 'AddOn' page with an apply_filters .... (if possible) Their plugin works with Ajax calls on plugin page admin, so when I ...
0
votes
0answers
43 views

Nested Actions and Filters

It is possible and a good practice to combine filters and actions, it is necessary to take into account the order in which they are executed, a graphic example https://images.app.goo.gl/...
1
vote
0answers
27 views

Unable to change footer using wp_footer action hook

I am learning Wordpress from a book and while learning about how to use action hooks the author gives the below code . I am assuming this would change the footer at the front end . <?php ...
3
votes
1answer
47 views

enqueuing React script and hooking its target div fails to load script

I am getting a silent failure on the below code as I try to enqueue a static React.js script and hook its injecting div into the admin_footer. I see the page and my test echo plus the url of the ...
0
votes
1answer
18 views

add_action with associative array

I am trying to get these parameters from the do_action placed inside body: do_action( 'custom_action', array( 'product_id' => $product_id , 'outbiddeduser_id' => $outbiddeduser, 'log_id' =>...
1
vote
0answers
42 views

How to list all WC products by their attributes values?

I wanted to get some advice on how to list all my inventory attributes values. I have this simple code that will output the products as plain text, But instead of the_title(); I want a list of all ...
1
vote
0answers
26 views

Instantiating classes through add_action and saving them to user_meta data [closed]

In my Wordpress.com site I have a form where users can add relationships of different types (coworkers, friends, etc.) and each relationship type has different fields but similar functionality. I had ...
0
votes
1answer
26 views

trying to add extra field using hooks

I am trying to add an extra field on the backend menu of Edit Subscription menu (SUMO Subscription (plugin) -> List of Subscription -> Edit Subscription) I am sending you a screenshot for where ...
0
votes
1answer
93 views

Use action, filter, or hook to append HTML to WordPress plugin function

I am new to WordPress actions, filters, and hooks, and am wondering if it is possible to use one of the three to append some HTML to a defined plugin function using the theme's functions.php file. The ...
0
votes
1answer
30 views

How to show only specific category post by user role without plugin and restrict all other cats

I am using basic post for adding posts. 5 categories exist ( cat_A, cat_B, cat_C, cat_D, cat_E). And I have 2 custom user_role for registered visitors that is 'viewer_a' and 'viewer_b'. I need to show ...