Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. 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
6 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
11 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
528 views

Redirect back to origin page after using get_delete_post_link()

I need to implement frontend and backend redirection after delete specific post using get_delete_post_link(). Which hook i can use? Any advice would be appreciated. Something similar to : <?php ...
0
votes
1answer
513 views

Adding to an array & passing it through do_action/apply_filters

For exercise I am working through a PHP class to add meta boxes I found on GitHub. I just copied the code and now I am playing around with it to understand it. It works like this: The file ...
0
votes
1answer
20 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 ...
1
vote
1answer
609 views

how to add submenu item under parent menu item with code

Well, here is my problem suppose i have a menu like this generated by wp_nav_menu() home test- test1, test2 contact about test is my custom post type so what i want to do is if a user/admin ...
0
votes
2answers
293 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 ...
16
votes
2answers
8k views

Why do some hooks not work inside class context?

I'm pretty stumped on this one. I'm using add_action inside my plugin class to do certain things- add scripts & styles to the head, wp_ajax, etc. Here's the actions, in the __construct: function ...
1
vote
2answers
687 views

$GLOBALS['hook_suffix'] variable empty

I'm trying to implement the code to add a custom post status from my plugin, exactly as given in this tutorial: http://jamescollings.co.uk/blog/wordpress-create-custom-post-status/ Now, it isn't ...
2
votes
1answer
2k views

wp_get_attachment_metadata returns false with add_action() 'add_attachment' hook

With the following code in functions.php - wp_get_attachment_metadata() returns false and or empty. Perhaps I am attempting to use wp_get_attachment_metadata() before it's ready? As some tests have ...
0
votes
4answers
597 views

wp_ajax action responds with 0

I'm writing a plugin. There is a button, that triggers an ajax-request to an action I added in my plugin page: Head of my plugin PHP file: add_action('wp_ajax_update_nav_items', 'update_nav_items' )...
0
votes
1answer
736 views

Put data in my-account/view-order/id/ page

Is ther a filter or an action to put information after order status information just before "Order Details" title? I found 'woocommerce_view_order' action, but it puts all at the bottom of the page.
0
votes
1answer
421 views

WooCommerce Hook: Content get's displayed twice and not AFTER the order total

I've overwritten WooCommerce's review-order.php to change the checkout a little bit. Now everytime I add something to the hook woocommerce_review_order_after_order_total the contents get displayed ...
0
votes
1answer
1k views

Edit WooCommerce product content based on category

We are using Google Translate to automatically translate our website but we want to exclude products in a certain category. We already accomplished that for some products by placing the <span class=...
8
votes
4answers
17k views

How to know what priority to use with add_action()?

I was writing a small plugin to remove some menu items for non-admin users from the backend, and discovered that my plugin didn't do anything unless I specified a priority in my code: add_action('...
0
votes
0answers
19 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
1answer
657 views

Add action to custom Function

I am trying to use plugin action in my custom function. Plugin is adding an action to wordpress registration form add_action( 'bp_before_account_details_fields', 'tv_bp_avatar_upload_form' ); But i ...
20
votes
4answers
33k views

Difference between do_action and add_action

This question might be wrong, I am not sure about it. Because I am not clear on this. I know add_action it is used to to hook our function to the specified function. For example add_action('wp_head'.'...
0
votes
0answers
26 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
31 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 ...
0
votes
1answer
2k views

How can I add an additional action button into the woocommerce admin order page?

I am using 'woocommerce_admin_order_actions' hook to add an additional action like Invoice. But it is repeating many many times whereas others button are repeating once. public function ...
0
votes
1answer
686 views

Exists filter or action that change Add New Post link?

I want to know if exists some method from filters or actions to change the link of the Add New button in backend , for example the regular url is http://wordpress_install/wp-admin/post-new.php but I ...
0
votes
1answer
620 views

Filter wp_dropdown_categories Per Post Type

I'm using wp_dropdown_categories to add a categories filter to the media library. It works fine, except it displays all the categories that are assigned to posts, but I would like it to only display ...
5
votes
3answers
843 views

Perform action on WPMU blog deletion

Hi guys :) I know there is the wpmu_new_blog action hook which enables us to perform an action when a new WPMU blog is created. Is there something similar to this which enables us to perform an action ...
0
votes
1answer
568 views

add_action template_redirect not working for home page

I am using bimber theme on latest wordpress. I wanted to force all frontpage views behind a login and added the following code in bimber's functions.php function members_only() { // Check to see ...
1
vote
1answer
14 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
1answer
556 views

WordPress user account activation

How do I implement user account activation in WordPress? (This is not for multisite.) Once the user registers through the site or admin panel, the user should get an email with an activation link. ...
0
votes
0answers
34 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
2answers
728 views

How to get list of all hooks of current theme / plugin?

I want to get the list of all available hooks from active theme / from a specific plugin. I was tried to get it from global variables $wp_actions & $wp_filter But, They are showing all registered ...
0
votes
1answer
887 views

AJAX login without a plugin does not work. when add a action to function.php

I am using wordpress ajax login without a plugin. I want to not be allowed users access to the WordPress profile after login, Because i have designed a specific profile in the link: http://www....
0
votes
1answer
791 views

How to get menu location in wp_update_nav_menu hook

I want to get the menu location in the wp_update_nav_menu (during menu save action) add_action('wp_update_nav_menu', function ($id, $data = NULL) { error_log( var_export($data, true) ); ...
9
votes
10answers
5k views

Remove an action from an external Class

I'm trying to do something similar to this question here: remove_action or remove_filter with external classes? I'm trying to remove the <!-- This site is optimized with the Yoast WordPress ...
1
vote
1answer
43 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
22 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
33 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
21 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
19 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 ...
3
votes
3answers
3k views

Convert hyphen to underscore in permalinks

I would like to use underscore in my permalinks instead of hyphen. Current permalink: www.example.com/2013/01/hello-this-is-a-test-post/ Desired permalink www.example.com/2013/01/...
0
votes
1answer
24 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
954 views

WP_LIST_TABLE bulk action

I created a class extend WP_List_Table and created method for bulk actions like this : function get_bulk_actions() { $actions = array( 'synchronize' => 'Synchronize', ...
3
votes
1answer
408 views

Wordpress admin notice in plugin function

i have sample wordpress plugin class. Im hooking woocommerce woocommerce_saved_order_items and i want create a admin notice. Add action from __construct works, but when i want create a notice in hook ...
2
votes
2answers
1k views

Using add_filter() in Widgets

Just have a query reference the add_filter() function. Can you use this function inside a WordPress widget class. Example I have a widget with dynamic created code that I want to pass to another ...
0
votes
1answer
972 views

Create action running on trashed_post hook to modify post_meta value

I have a custom post type that always do math operation to its post_meta and other custom post type post_meta. For example: post-type 1 = cpt_product_order post-type 1 post_meta = ...
1
vote
2answers
2k views

admin_post hook not called

I have good experience in other CMS. but I'm very new in Wordpress. My goal is to intercept POST values in some of the form of a pre-existent site. Following documentation I've done the following ...
2
votes
1answer
797 views

Add custom buttons with custom actions in Edit Post screen in WordPress?

I am creating something for a client and I have a Class that I created with a Custom Post Type called 'PuSH Feeds' and when the user adds a new post and publishes it they can then click on one of two ...