Questions tagged [hooks]

Method by which plugins and themes extend core WordPress functionality.

Filter by
Sorted by
Tagged with
0
votes
1answer
13 views

Insert Multiple Post with Same Publish Button

I have created a custom post and fields are created by using Meta Box. Now what I am trying to achieve is: Suppose a user enters 3 IMEI numbers, but when the user hit Publish Button, in Background ...
0
votes
0answers
19 views

Change WooCommerce Coupon notice/error message [closed]

I would like to change the default 'Coupon "%s" does not exist!' error message of Woocommerce. However, this seems to be a much harder task than I imagined - found no trace of it in the docs. The ...
0
votes
0answers
24 views

How to remove duplicates from product column (Custom field) in woocommerce

I have two fields one is name/title of the product and second one is a custom field stock number (stock_number) all the products have name/title and stock number I am only showing stock number in the ...
0
votes
0answers
11 views

Hook for upload completion?

I'm trying to execute a command after a file has uploaded, but I'm not getting very far. wp_handle_upload_prefilter fires before the file is fully written to disk and moved from its temporary location,...
0
votes
0answers
17 views

Fire function when meta data is requested

My database is getting filled from an external application. All works perfect execpt the caracters. They are unicoded like \u2122. I have made an very simple plgin that filters the given string to the ...
-1
votes
1answer
27 views

WooCommerce Hook after Billing form completed, but before payment Gateway

In Woocommerce, I need to call a function after than the client completed the billing form, but before the payment gateway. This function needs to use the billing form informations... Is there a Hook ...
0
votes
0answers
24 views

Dynamic page for nav items used as filters

I have a bunch of nav items and each of those items are used as a "filter", this filter means that when clicked the user should go to a page that has only the items matched with the filter clicked, my ...
0
votes
1answer
22 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
13 views

Override wp_delete_post and move to trash instead for custom post type

The function wp_delete_post() will permanently delete when used on Custom Post Types. The force flag only works on PAGE and POST cpt. See this post as an explanation of how the force flag is being ...
0
votes
0answers
16 views

Wrap post images with a link, not figure (image_send_to_editor doesn't work)

The new version of WP wraps all images put into a post with a figure element, instead of a href. I tried to use this hook in my functions.php if( is_admin() ) { add_filter( 'image_send_to_editor', '...
1
vote
1answer
18 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 ...
0
votes
2answers
90 views

Generate images to be associated for tag and category?

I’d like to generate images suitable to insert into metadata (like Open Graph or twitter:image). Basically I want to create a collage based on posts for each tag. So let’s say I had the tag “cats” ...
0
votes
2answers
70 views

How to Update the Order-Items While Editing an Order on the WooCommerce Admin Order Screen [closed]

Is it possible to edit order item totals and custom fees in the woocommerce admin edit order screen? The only hook that I can find is woocommerce_new_order_item, but when I add/remove a product in the ...
0
votes
1answer
30 views

Is it possible to assign a css id to a row in plugins list table?

How can I add a CSS id to the row that contains my custom plugin in the plugins list table i.e (/wp-admin/plugins.php)? What I want to achieve is displaying an admin notice like this <p>...
0
votes
1answer
52 views

Adding new divs with custom classes to products on WooCommerce shop page

In a custom Wordpress theme I need to display product image and product summary side by side on the WooCommerce shop page, so I am trying to add new divs with custom Bootstrap classes; I used ...
1
vote
0answers
14 views

`rest_user_query` can't access post author in post edit screen

I'm trying to modify the user dropdown in the post edit screen to show only (a) the current user and (b) the current author of the post. I can't do this using wp_dropdown_users_args because the meta ...
0
votes
1answer
26 views

How to render an element, that was saved as a template, using a hook?

My goal is to render one identical element on every page. At the moment this element is manually added to 50+ pages. I saved it as a template named 'reusable' and then i want to call it from functions....
-2
votes
0answers
20 views

WooCommerce Variable Product Custom Field

I would like to add a custom field to both regular products and variable products. I am planning on using these hooks: woocommerce_variation_options_pricing and woocommerce_product_options_pricing. ...
0
votes
1answer
100 views

Fatal error: Uncaught Error: Class 'WP_Block_Styles_Registry'

I am having some issues determining the solution to this problem below. The website was sent to our team to fix. Turned on error reporting in wp-config.php: define('WP_DEBUG', true); ...
0
votes
1answer
19 views

Call a single function on two different methods with hooks

So I'm wanting to shorten my code down a bit and I would like some assistance.. How can I shorten the following methods into a single register method? They both have add_action which is a WordPress ...
1
vote
2answers
30 views

When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?

the_author() filter hook can be used to modify the output of the_author(). When using the hook, is it possible to know which PHP file generates which call to the_author()? For example, say I have ...
0
votes
0answers
22 views

Custom meta box is not displaying value showing tag as empty

I have a created a custom meta box plugin and a function in the functions.php file to output the value on the page. The meta box seems to be working, however the input text is not being displayed on ...
0
votes
1answer
34 views

Why wp_ajax hooks doesn't work?

I need to execute the Php function from my Ajax form with the POST method. Is there another way instead of ajax hooks? Hooks doesn't execute. Always returning 0. What's wrong? Here's my ajax.js '...
0
votes
2answers
38 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
17 views

Add a custom submenu under submenu in a Custom Wordpress Plugin

I know how to add custom menus and submenus for the custom plugin. But for creating another submenu under submenu is what I cannot figure out. What I have: Plugin-Main-Menu Add Update Event What I ...
0
votes
0answers
26 views

Cannot Add Two Scripts to Header

I am trying to add two scripts to the header of my site. I can install a single script, such as this: <script type="text/javascript">console.log("testA")</script> I am not able to add ...
0
votes
0answers
21 views

Edit plugin function with a hook

I've just spent 2 days on trying to pass/change an argument in a plugin's function but had no luck so far. Would anyone, please, show me the correct way or solution how to do that? I need to be able ...
0
votes
1answer
12 views

When/where would want to attach other classes to the base class in a WordPress plugin?

I have two plugins I'm looking at currently. Each has a function called plugin_classes which attaches other classes to the base class. Both of these plugins have init and hooks functions. In the ...
1
vote
1answer
22 views

wp_loaded hook block script enquequing

I have a cutsom maintenenace screen generated by a plugin for non admin users. I need to setup a countdown timer on it if an option on the related settings page is enabled. I've implemented the ...
0
votes
1answer
39 views

Custom filename when pasting an image from clipboard

I've used a plugin with the classic editor that enabled me to paste images directly from the clipboard, into the post. But only used this when the filename did not matter seo wise. With the Gutenberg ...
0
votes
0answers
15 views

Add User in Admin and Redirect to Edit Profile Page instead of Users List

I'm probably missing something super simple, but how can I redirect the admin user to the edit profile page when they create a new user? I've tried to hook into this: edit_user_created_user and then ...
0
votes
0answers
15 views

customize_controls_enqueue_scripts doesn't fire from within my plugin

I have a plugin that builds a Class which handles injecting Customizer features. Within it I am inserting: Customizer Panel > Section > Settings/Controls The controls I am I am injecting a Select ...
0
votes
0answers
21 views

Prefixing widget_posts_args Hook

I am working on a theme that I am trying to submit to wordpress.org. I tested the code with theme sniffer plugin and I have the following error: Hook names invoked by a theme/plugin should start with ...
0
votes
1answer
45 views

PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered

Can someone help me fix this error? PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, ...
0
votes
0answers
20 views

Apply discount to woocommerce booking total

I'm trying to find a solution to add a discount to the total price on the booking window. The WooCommerce Bookings changes the values with jQuery and I tried these hooks with no luck. WooCommerce Add-...
0
votes
2answers
28 views

using filter and hook inside class

I'm going deep with oop to create wordpress plugins. I've found an interesting article about the hooks and how to use them inside a class. After reading I have some doubt: is correct to use the hooks ...
0
votes
1answer
12 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?
0
votes
1answer
27 views

Add a check box in Menu Settings

I'm looking for the appropriate hook to add a check box in Menu Settings, and if it exists, how to save the value as an option .
0
votes
0answers
18 views

Disable publish button when post title is empty

function disable_publish_button($post){ if(!$post){ return; } if('publish' === $post->$poststatus && $post->post_title === '') { } }; add_action( '...
0
votes
1answer
10 views

Updating a related post's “post_modified” value

I have two custom post types; 'projects' and 'activities' - when an activity is created / updated, I want to update elements of the project - one of these elements is to update the 'post_modified' ...
0
votes
1answer
24 views

Discount in the specific product title using keyword ( Woocoommerce )

is it possible to create a function that calculates the 10% discount by specifying that in the "Clothing" category all products that contain only the word "shirt" in the title? Or rather is possible ...
0
votes
1answer
17 views

How to override include_once pointed file using add_filter?

I want to customize a plugin which uses a file called html-vendor-order-page.php to define the style of contents: include_once( apply_filters( 'wcpv_vendor_order_page_template', dirname( __FILE__ ) . ...
0
votes
1answer
131 views

How can I disable W3 Total Cache Image Lazy Load for Specific Post Type?

I'm using W3 Total Cache plugin for my WordPress site. I've enabled Lazy Load setting option, but I want to disable the option for the specific post type. How can I hook and disable it?
0
votes
1answer
19 views

Get post_author email for Zapier Integration

I'm creating an automation on zapier that allows you to send a notification to the authors of the posts based on the status of the post. Among the various post fields there is no "user_email" which ...
1
vote
0answers
15 views

get current date + 90 days and checking every day

User can submit post from frontend submission form. Fieldname: Title (entered by user) expire_date (entered by user) expire_date1 (invisible) expired (invisible) When user enter no value for "...
0
votes
1answer
32 views

WordPress hook after post content and meta update

I want to update one of my meta field and redirect and I am using post_updatedhook. Here is my code. function job_publish_status( $post_ID, $post_after, $post_before ) { $job_published_date = ...
0
votes
1answer
42 views

Is it possible to add a shortcode below post title?

I have a shortcode that I want to place below title of all my posts. Is there a hook or a filter I can use for this?
0
votes
1answer
23 views

flush rewrite rules after plugin update?

I am working on a plugin that registers custom new endpoints in every update and we need to Flush Rewrite Rules after every update of the plugin. Flushing Rewrite Rules are easy after activation of ...
0
votes
0answers
13 views

wp_video_shortcode_override in post editor

I am using wp_video_shortcode_override in my plugin to override default wordpress video and it works well in frontend. My question is is it possible to make this work in post editor backend? ...
0
votes
0answers
10 views

Is there a way to completely replace the sidebar in the admin panel?

Pretty new at this and was wondering if there is any way of completely replacing the sidebar in the admin panel? I found the hook do_action( '_network_admin_menu' ); but I'm not sure if that is the ...

1 2 3 4 5 38