Questions tagged [actions]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
30 views

Which action is triggered when a theme was modified?

I want to intercept plugin changes, but no action hook listed in the Action Reference seems to do it. I tried after_switch_theme which is triggered only after changing from one theme to another, and ...
0
votes
1answer
193 views

New bulk action to resend welcome emails

I have added a new custom bulk action to the user listing page called Resend Welcome Email, it is showing and running. What I'm looking to do is fire the Resend Welcome Email plugin's action. I'm ...
0
votes
0answers
41 views

Removing Plugin Action via Theme for Non-admins

add_action( 'plugins_loaded', 'mytheme_remove_show_my_balance' ); function mytheme_remove_show_my_balance() { if ( !current_user_can( 'administrator' ) ) { remove_action( 'personal_options', ...
0
votes
0answers
15 views

When calling a function with admin-ajax.php, what is the first parameter? [duplicate]

I'm trying to make a function that can either be called directly or via admin-ajax.php. Strangely, when calling it as an AJAX function, the first parameter's value is a blank string. function ...
0
votes
1answer
34 views

Adding JavaScript file in Admin Panel

I am learning WordPress plugin development. I am trying to attach a jQuery/JavaScript file in Admin Panel. I am using below code in plugins index.php file. function admin_script() { ...
1
vote
1answer
24 views

Adding buttons to Add New Post and Add New Page

I want to add a button in Add New Page and Add New Post pages. Here are places I want to add items: New page's sidebar (next to Page Attributes). New post's sidebar (next to Post Attributes). New ...
1
vote
0answers
57 views

Set a custom display_name on user_register?

I'm trying to force a specific "display_name" using data collected in a wpforms registration form. In the registration form, I've got a field for "last name in high-school" and a field for "nickname ...
0
votes
1answer
377 views

How to position user meta data field

I have 1 additional field I want to display on the user profile page (mainly admin users will use this) I have done it but it is showing up at the very bottom of the page, I want it to sit in the ...
0
votes
2answers
241 views

do_action not working in loop

I've been using do_action to generate multiple action hooks in the loop. It seems unlucky for me the do_action not working. function ltc_generate_input_fields($fields = array()) { echo "Hello ...
0
votes
1answer
301 views

How to change lost password email text using custom plugin wordpress?

In wordpress, i want to add one extra parameter(ABC) in lost password link with key (lost password email text). I have added many hooks. add_action( 'password_reset', 'password_reset_hook', 10, 2 ); ...
0
votes
1answer
124 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
1answer
110 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
1answer
19 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
2k 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
1answer
20 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
33 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 ...
2
votes
1answer
119 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
72 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
69 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
173 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
416 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
18 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
185 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
119 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 ...
1
vote
0answers
226 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
1answer
50 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
75 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
281 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 ...
1
vote
0answers
394 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
1answer
2k 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
254 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
23 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
145 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
766 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
108 views

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
39 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
163 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
249 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
77 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
174 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
534 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
705 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
444 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
56 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
325 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
84 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
80 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
27 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
40 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
2k 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 ...

1 2 3
4
5
28