Questions tagged [actions]

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

335 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
1k 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
86 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 ...
0
votes
0answers
65 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
38 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
86 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
72 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
0answers
106 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 ...
0
votes
0answers
180 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/...
0
votes
1answer
38 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' =>...
0
votes
1answer
554 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
54 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
165 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
71 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
71 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
2answers
24 views

How can I see exactly what arguments are being passed through a filter so that I may modify them?

I'm having a great deal of trouble phrasing this. If I were to use the filter views_edit-page How can I see what exactly is being passed through the filter so that I may edit them? Normally I ...
0
votes
0answers
21 views

publish_post action callback not executed, why?

I create a custom post type and I insert programmatically a new post of that type with wp_insert_post with draft status. I need to send and email when in backend the post is published so I used ...
0
votes
1answer
68 views

WordPress set featured image to first image of the post

I have tried every solution from similar answers and nothing seems to work on Wordpress 5.0 + When saving a post I want to set its featured image to the first image in the post content. function ...
0
votes
1answer
84 views

Postback redirect through add_action is not triggered

template: <form action="<?php echo esc_url( admin_url('admin-post.php')); ?>" method="post"> <input type="text" name="boo" id="boo" required> <input type="hidden" name="...
0
votes
0answers
77 views

profile_update hook does not fire from front-end

I'm using BuddyPress to allow users to log in on the Front end. Once logged in, they can click on 'My Account'. On this page they can upload avatars, edit their account information, etc. When I ...
0
votes
2answers
65 views

How to pass argument to add_action while the method is inside a class?

in my functions.php I have require 'autoloader.php'; add_action('init', 'MyClass::make'); and in my MyClass class I have class MyClass { public static function make($type) { var_dump($...
0
votes
3answers
39 views

add_action where function has arguments

I have a general question about functions and add_action to it. I have a function and adding an action do it. But how can i define a value for the argument on this action? add_action( '...
0
votes
2answers
144 views

Add HTML code before the title of the Tag page

I want to show an iframe at the top of a specific Tag page, so once I have is_tag('my_tag'), I will add the iframe before the title of the page. I've tried this code to show the iframe before the ...
0
votes
0answers
125 views

WordPress Plugin Boilerplate - add actions and/or filters based on user's role

I am developing a plugin using WordPress Plugin Boilerplate. Some of its functionality need to be available only when a shortcode gets resolved in a page and furthermore some of it only if a user is ...
0
votes
1answer
69 views

Get post content inside plugin class method

I'm writing a simple SEO class that will add the various metatag to the header of wordpress. I've two little problems with the wordpress api. The first is that I need to remove the last comma from ...
0
votes
0answers
119 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
0answers
99 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
2answers
1k 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
93 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
2answers
937 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
0answers
15 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. ...
0
votes
0answers
118 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
34 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
1answer
333 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
67 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 ...
0
votes
0answers
59 views

Remove action added in plugin class from theme

I am trying to remove action that is added via plugin in my theme. The below plugin class creates a portfolio page template but I don't want this page template in my theme. Is there any way to unhook ...
0
votes
0answers
192 views

wpdb->insert creates duplicate rows

mypage.php $create_args = array( "user_id" => get_current_user_id(), "description" => "Your order #".$order_id." has been successful" ); do_action('...
0
votes
0answers
309 views

add_action don't updates theme layout when using values from the WordPress customizer

I am trying to control the order of the information displayed in the WooCommerce single product page via the customizer with a sortable control. The user can select if the different elements are ...
0
votes
0answers
239 views

Why should I need to add init action to include PHP file to WordPress Plugin?

I wanted to include a PHP file to my plugin. So I added following code to top of my plugin. require_once( plugin_dir_path( __FILE__ ) . 'inc/test-file.php'); But it didn't worked. Then I tried ...
0
votes
1answer
889 views

How to change form action of wp-login page with a function

I'm manually creating my own Wordpress login form. The action parameter of all the forms points to wp-login.php. I want to change it for all of them to custom url (/login). Any idea how to that? For ...
0
votes
0answers
163 views

adding an action inside if condition not working

This is my function $enable = false; //if false is provided then the action should run and remove the breadcrumbs if($enable ===false){ add_action( 'init', 'woo_remove_wc_breadcrumbs' ); ...
0
votes
1answer
74 views

Woocommerce add a text field if specific option is selected

I need to make active/visible a new filed before 'Add to cart' button, only if user select a specific option. The case is simple: I sell t-shirt with options: "Small", "Medium", "Large", "Size upon ...
0
votes
1answer
157 views

Remove action from plugin

I'm trying to remove an action in edit_user_profile from a plugin. But I don't know how to do, This is add_action from the plugin : https://github.com/jaredatch/Basic-User-Avatars/blob/master/init.php ...
0
votes
1answer
418 views

How to remove an action added by a child theme of Genesis

I developed a child theme for Genesis that adds Bootstrap on top of it. In the core of this child theme I edited the way the category is displayed in the post, putting it above the title. Now, I'd ...
0
votes
0answers
245 views

Unhook a function within a class in the child theme

I am using Hestia theme and I want to unhook the function that displays footer copyrights to replace it with my custom function, I tried the remove_action() in my child theme functions.php but it didn'...
0
votes
0answers
22 views

When would it be best to hook AJAX functions on a back-end page?

I'm setting up my page as follows: add_action( 'admin_menu', [$this, 'addAdminMenu' ], 80 ); And its content: public function addAdminMenu() { $this->hook_suffix = add_theme_page( ...
0
votes
0answers
240 views

add_filter not works in ajax

I edited my woocommerce loop products with remove_action and add_action functions. And create ajax infinite scroll. I created woocommerce.php and put all my action functions to it. And called ...
0
votes
0answers
18 views

How to store additional data that is related to core data

Long story short, I am going to be building a web application with WordPress as the framework. We have to use WordPress, I cannot suggest a different framework. The application will have users with ...
0
votes
1answer
251 views

Using add_filters() , apply_filter(), add_action() and do_action() in extending a plugin

Suppose i am developing a plugin that is related too booking.Next time i want to add an add-ons on that plugin for payment.Then i added another add-ons for paypal payment. Assume that below is the ...
0
votes
0answers
565 views

Change hook to add_action in a plugin class

<?php namespace wp_gdpr_wc\controller; use wp_gdpr\lib\Gdpr_Container; use wp_gdpr_wc\lib\Gdpr_Wc_Translation; use wp_gdpr_wc\model\Wc_Model; class Controller_Wc { const REQUEST_TYPE = 3; ...
0
votes
1answer
462 views

add_action init breaks site on PHP 7.1

If there's no child theme available, I use a custom plugin for some minor changes. The following code for hiding update notifications etc. has always worked perfectly. However, if I switch from PHP 7....

1 2 3
4
5
7