Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [hooks]

Method by which plugins and themes extend core WordPress functionality.

1
vote
1answer
24 views

How to get rid of the hover zoom in WooCommerce single products

I'm trying to get rid of the function where users can hover over the main product image and zoom into the product. I tried using this code, which has been confirmed by others to work, but nothing ...
1
vote
1answer
19 views

Replace existing content from specific WooCommerce admin orders list column

How do I either replace or completely remove a column in the Woocommerce Orders list in admin? I know that there's possible to just uncheck the "Shipping address" column from the "Screen Options" and ...
0
votes
0answers
16 views

Private School Application Form

I'm attempting to set up a new application form for a client whose current form was done by a previous developer with jquery. It seems to only work with PHP versions of 5.6 or below. I'm not familiar ...
0
votes
1answer
35 views

WordPress hook which triggers on post import

I am adding few meta fields for product post type using wp_insert_postaction and it is working perfectly. But I have to trigger my function upon product imports as well as this action is not firing ...
1
vote
1answer
22 views

How can I set status='publish' for all featured images?

Background: I've come accross this WP issue: https://core.trac.wordpress.org/ticket/41445 In short: when you make a request to a post over the REST API, if the featured image was originally uploaded ...
1
vote
0answers
24 views

Which allowed API hooks work to add wp_ajax action?

Each time I have to add an ajax function in a WordPress plugin, I lost time to know what is the problem. So I decided to wrap add_action("wp_ajax{$function_name }", array( $function_class, $...
0
votes
1answer
26 views

WordPress plugin activation, deactivation and uninstall hook not being triggered

I am developing a WordPress plugin which requires certain rules to be added to the .htaccess file of the WordPress installation upon activation of the plugin. Initially, before I switched my code to ...
0
votes
1answer
22 views

I don't understand how add_action and do_action work in tandem. The former executes the code already…what is do_action for?

I've tried reading the documentation and the definitions just elude me. I found this example that works here for my troubles -> https://stackoverflow.com/questions/50286549/how-can-i-store-the-values-...
1
vote
1answer
29 views

Customize WooCommerce orders displayed shipping

I'm using the following code to update the Shipping text on the Cart and Checkout page in WooCommerce /* Change Text for Shipping message when shipping is $0.00 AND remove the "Shipping" text ********...
0
votes
0answers
24 views

How restrict some data for some users?

I need a professional advise. I need a simple function that will block&replace some WP-WooC database widely used data (as Site Name, User Name, Taxonomies, Products Attributes, etc) from ...
1
vote
0answers
43 views

Get all posts with a duplicate name

I am running an import script which adds a large number of product post types. Some of these are identical apart from perhaps a size or colour value in the CSV. My script creates the new post types (...
0
votes
1answer
37 views

How to Remove a Filter from the Admin List Table?

I don't want the "Registered customer" filter option for the Admin Orders page. I have tried to search for how to remove it. I have been inside the WooCommerce codes to see how it's implemented. And ...
0
votes
1answer
11 views

Wodpress XML Import hooks

Having the task to merge posts from given remote sites in one site under a given category how do I hook the import plugin to save the posts for a given category: Given example: receiver site has ...
0
votes
0answers
22 views

Put CSS Content inside tag <style amp-custom> for Wordpress

I just want to put the CSS's content inside tag <style amp-custom> This is my action inside function function amp_template_add_styles() { $stylesheets = get_template_directory_uri() . '/...
1
vote
1answer
40 views

How to use wp.hooks.addAction() in React JS/Gutenberg?

I am able to successfully use wp.hooks.applyFilters() and wp.hooks.addFilter(), but I'm not able to render a React Component using wp.hooks.addAction(). However, the console.log() runs just fine ...
2
votes
0answers
62 views

How to use wp.hooks.addAction() in React JS [duplicate]

I am able to successfully use wp.hooks.applyFilters() and wp.hooks.addFilter(), but I'm not able to render a React Component using wp.hooks.addAction(). However, the console.log() runs just fine ...
2
votes
1answer
11 views

Seeking Hook Whenever a Custom Taxonomy Term Has Been Added

I'm looking for a hook that fires whenever a new term is added to a custom taxonomy. I tried set_object_terms and create_category but I can't get them to work it seems. I need a hook that will ...
1
vote
2answers
41 views

Send a custom notification to customer on WooCommerce cancelled order status

In WooCommerce, I am trying to send an email notification to the customer, when an order has a status "cancelled". Here is my code placed in my child theme's function.php file: add_filter('...
0
votes
0answers
13 views

Gutenberg extend core file block - Add img tag before file name from a hook

There is a hook to extend a core block with filters and add style to a block. function addBackgroundColorStyle( props ) { return lodash.assign( props, { style: { backgroundColor: 'red' } } ); } wp....
1
vote
1answer
22 views

Can I differentiate between “Delete Post Permanently” and “Empty Trash” and do something for each accordingly?

I'm currently working on developing a plugin with a custom post type of "Dealer Location". (Not relevant to question, just a bit of background) When a post is in the trash and "delete permanently" is ...
0
votes
0answers
11 views

How to filter error message when requesting more product quantity than is available

I'm trying to filter the message that shows WooCommerce, when the product reservation is not allowed. The message that is displayed when you want to add in the cart more stock than is avaiblable. ...
0
votes
1answer
42 views

What Hook/Action is performed when a field in checkout form is changed in WooCommerce

I have added a custom field in WooCommerce checkout like below: function oc_add_checkout_fields( $fields ) { $fields['shipping_sub_area'] = array( 'label' => __( 'Sub Area' ), ...
0
votes
1answer
17 views

Updating user meta data from external link, user not logged in

My login process is exactly like this: 1- user put email in the form 2- a link sent to email for setting password 3- user click on the link and redirect to website with code like this: https://www....
0
votes
0answers
17 views

Help hooking into user_register

I'm trying to do a POST request to my API when a user is created. I've installed Code snippets and added the following: add_action('user_register','my_function'); function my_function($user_id){ ...
0
votes
1answer
12 views

Add Index to Item in Wordpress Gallery

I'm creating a gallery of images using the [gallery] shortcode and Jetpack's tiled gallery feature. When the user clicks on an image I'm triggering a carousel (Owl Carousel) with carousel.trigger( 'to....
0
votes
0answers
42 views

How to prevent post update using transition_post_status

I am building an application using WP REST API. Ideally, users are able to post only if they have a subscription. Here is how I plan to make things work: Set expire_by user meta when they sign up. ...
4
votes
1answer
36 views

What is the earliest possible hook for safely using `is_front_page`?

When a page request is made, at what point does is_front_page start working? As I recall, if you try using it too early it will always return false. My assumption is that the wp action is the first ...
0
votes
0answers
17 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
1answer
38 views

Calling hooks in functions

I'm comfortable with theme hooks, regularly add features, but struggling with a plugin hook, to filter content. It's at the limit of my knowledge, and I'm trying to understand the process, to no avail....
1
vote
0answers
21 views

Save acf field data via acf/save_post before post is saved

I have 4 advanced custom fields and I would like to save each field value when it is changed on the post and not have to wait until the post is saved. I'm using acf/save_post action. Here is my code ...
0
votes
1answer
15 views

How to use filter to disable adding a product to wishlist?

I am using a plugin on my website that made the following filter available: Added filter ‘tinvwl_allow_addtowishlist_single_product’ that helps to show/hide the “Add to Wishlist” button for ...
0
votes
0answers
31 views

Sort custom post archives by a meta value from a different custom post type?

To make a long story short, I have a custom post type called artworks with these meta fields: title catalog_no artist_key I have a second custom post type called artists with these meta fields: ...
0
votes
1answer
28 views

How to change a WooCommerce Subscription Deposit and Monthly Payment?

A customer wants some specific/bespoke discounts to the subscription service they sell. I cannot find a plugin to do what they want, so thought I would code it myself. But I cannot find how to edit ...
1
vote
2answers
37 views

Assign category from custom field on post creation and update

I'm trying to hook on save_post to automatically assign a category (from a custom field) on post update and creation. Basically if the date event is 10/10/2020 - I want to assign the event to category ...
0
votes
0answers
6 views

Add data into the table after successful share on social media

I am using Listing pro theme.Theme provide's social share of different listing in the site that is Facebook,twitter,pinterest,google plus,reddit,stumbleupon,linkendin etc. I have checked in the theme ...
0
votes
1answer
36 views

Save user total active time after login in wordpress [closed]

I want to calculate the total active time of the user after user login in wordpress site. For this i am using the following hook in my custom plugin: add_action('wp_login', 'save_login_time', 10, 2)...
0
votes
2answers
39 views

How can I add a <br> so i can show sale price under normal price

I need to show sale price under normal price, not on the same line
1
vote
1answer
71 views

Remove action on product archive page [closed]

I have a product description which is hooked into my product archive page in the following way by my theme (The7): /** * display short desc hook. * * @hooked woocommerce_template_loop_rating - 5 *...
0
votes
0answers
15 views

adding wordpress yoast SEO canonical url from “transition_post_status” hook

I am using transition_post_status hook to add get some data at the time of post is publish but i can access any variables but when i am trying to set canonical url from add_filter it is return 500 ...
0
votes
0answers
27 views

wp_update_post not getting triggered by hook

I am not able to make make a hook trigger this action from functions.php file. If I put the same code in footer.php, it works, but not in functions. In the end I would like to set up a cron job to ...
0
votes
1answer
17 views

Problem in plugin debuging in wordpress

I want to save extra user fields in custom table after user register. In my plugin I added user_register hook and I am checking this code while user register but I cannot find any errors and cannot ...
0
votes
0answers
10 views

lostpassword_post hook redirect to core login page

For the site: www.akkade.be I use the plugin user-registration by wpEverest, login & registering works fine but the lost password form just redirects me to the core login page the lost password ...
1
vote
0answers
37 views

When using the block.getSaveElement hook can you output different markup based on whether or not you are in the edit view or the live page view?

I am trying to extend the core/image block to add an option for a deferred image. I want to replace the src attribute of the image with an empty string and add the url as a data attribute to be loaded ...
1
vote
1answer
30 views

Adding body class to login page?

I can't figure out for the life of me how to add a custom body class to the WordPress login page. I found this thread, which suggests using the admin_body_class along with this one to check if the ...
1
vote
1answer
67 views

Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons

I’m trying to change the svg of the ellipses for the mobile menu. It’s called in this file: template-functions.php so I did a hook on my child theme functions.php to replace it, like so: function ...
0
votes
1answer
36 views

password_reset doesnt work

Im trying to use $_POST method after password reset submit action here is the code add_action( 'after_password_reset', 'action_function', 10, 2 ); function action_function( $user, $new_pass ){ if ...
1
vote
1answer
26 views

Which hook should I use to capture $_POST('password') via profile update and password reset

I need to rehash the password which the user entered during Wordpress registration (I use WooCommerce) I'm successfully able to do this with the following: add_action( 'user_register', '...
1
vote
0answers
13 views

Why ajax doesn't work on certain wordpress hooks and reload the page instead?

I built an ajax function which works perfectly when i hook it to admin_head or admin_notices hooks but it doesn't work when i hook it to manage_posts_extra_tablenav hook, instead of doing the ajax ...
1
vote
0answers
21 views

Why ajax doesn't work on certain wordpress hooks?

I built an ajax function which works perfectly when i hook it to admin_head or admin_notices hooks but it doesn't work when i hook it to manage_posts_extra_tablenav hook, instead of doing the ajax ...
0
votes
2answers
44 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 ...