Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
0answers
15 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
21 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
23 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....
-1
votes
0answers
13 views

Using a custom REST API in WooCommerce, the data from do_actions in content-product.php do not generate any output. Why?

I have WooCommerce v3.5.6 installed, and the code works as expected. But, if updated to any subsequent versions, all these do_action statements have no output over the REST API. do_action( '...
0
votes
1answer
25 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
29 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
40 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
16 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
51 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
47 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
19 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
18 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
25 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
22 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
28 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
32 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
15 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
42 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
58 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
25 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
36 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
22 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
29 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
16 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
21 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
25 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
47 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
28 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 ...
0
votes
1answer
43 views

Use wc_enqueue_js only on specific pages - nested add_action

In my plugin, I'm trying to add inline script using wc_enqueue_js only on the cart page. The rest of the plugin is also executed only on the cart page. The code below works fine, but I don't like the ...
0
votes
1answer
25 views

Best hook for when a user session ends?

I'm creating a backend feature that calculated user's login sessions during the past 2 weeks. This is easy enough to do by incrementing a custom user field when the user logs in using wp_login: ...
0
votes
1answer
37 views

why require - does not load filter

I am using the boilerplate for WordPress plugin : https://wppb.me/ but I don't know if it's because of there coding this is happening. What I am trying to do is use require and load the below code ...
0
votes
1answer
57 views

add_action doesn't work for my function

I'm trying to build a function which run when a member is registering on my site. I am building an extranet using the Simple LDAP login plugin to use my LDAP directory so that users connect on the ...
0
votes
0answers
11 views

Check custom User meta before Insert

My goal is to check if my custom user meta field 'subscribe_to_newsletter' has been changed. If so i will be sending an API call to mailchimp to change the users status. I currently have a front end ...
0
votes
1answer
38 views

add_action('init') not work

my code is add_action('init', 'user_logged_in'); function user_logged_in(){ if( is_user_logged_in() && is_page('login')){ wp_redirect(home_url()); exit; } } the page slug ...
0
votes
0answers
24 views

How to find out the page name or slug inside a filter?

How do I find the page name or page slug inside a filter in a plugin? I am customizing a plug-in and I need to run some code based on which page is currently being displayed. The code is inside a ...
0
votes
1answer
16 views

Translate are not working for standard admin

I'm developing a plugin which uses strings of the "default" textdomain, but several strings will not shown translated. My locale language is "de_DE" (german). I try to access the word "Count", which ...
0
votes
2answers
70 views

W3TC manual cache flush does not work

My need is to have a .php file that is located in the root folders of all WordPress websites I manage, which can flush all cache of all sites. Therefore, I created a file "flush-cache.php" in the ...
0
votes
1answer
60 views

When does save_post hook fire on post save/update

In my plugin I want to update sitemap every time page or post is created/modified. To achieve this I use save_post hook: add_action( 'save_post', 'update_sitemap', 10, 3); Upon creating/saving/...
0
votes
1answer
24 views

how to use apply filter for Class?

Please do not remove the question saying that it's woocommerce. In the code below there is $fields = wp_parse_args( $fields, apply_filters( 'woocommerce_credit_card_form_fields', $default_fields, $...
0
votes
0answers
27 views

How do I remove an action hook inside a class that is called by another class?

Okay, so I am using the "FooEvents for WooCommerce" plugin for making WooCommerce products to events. And now I wanna replace their WooCommerce hook 'woocommerce_order_status_completed' with my own. ...
0
votes
0answers
28 views

Woocommerce - action to new order comment/note hook

I would like to send some other user the order notes once added by the admin in each order from wp-admin. So when admin adds a new comment on a order i would like to notify some users about it. I ...
0
votes
1answer
42 views

Passing function into add_action always returns the first argument

I'm building a plugin that iterates across and parses the arguments of various WordPress hooks, and because of the flexibility needed I'm passing a function as the callable parameter in add_action: ...
0
votes
0answers
39 views

How to use WordPress hooks in add new page with the Gutenberg UI?

I would like to add a custom link to the Add New Page > Page Attribute > Below or above the "Template Field". Please check my screenshot: http://prntscr.com/o3pjut Before Gutenberg, I simple used to "...
0
votes
1answer
49 views

WooCommerce: after install hook

There is some hook that is triggered after WooCommerce Install (I mean the WooCommerce Wizard, not the plugin installation)? I didn't found a hook to do this and the Wizard Class (...
0
votes
0answers
12 views

Usage of predefined actions in WP Cron

I have a working wordpress cron, that is executing as expected. Inside the cronjob I want to use the action plugins_loaded. /** * Daily event. */ public function ...
0
votes
0answers
24 views

help on a hook to hide one cpt category for users on a specific membership

I would like to hide one specific category of a classifieds plugin (ACADP) when submitting a classified using the plugin form, but only when the logged-in user is registered on the free membership. I ...
0
votes
1answer
19 views

Run a function on all posts

I have a function where I am counting letters in a title and adding that _product_meta_title key, everything is working fine when I am adding a new product but I have 500 products that don't have this ...
0
votes
2answers
54 views

add_action in wp_head accessible from class

Given this code: class test_class { function greeting() { echo 'Howdy! Test is successful!'; } function greeting_head() { //Close PHP tags ?> <?php ...