The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [hooks]

Method by which plugins and themes extend core WordPress functionality.

Filter by
Sorted by
Tagged with
0
votes
0answers
6 views

How to Schedule (run) another Cron Schedule inside of a Cron Action

i am using this code to run a daily normal checkup cron... but i have another cron which will happen every ten minutes and update each user record according to my condition... but how do i run a new ...
1
vote
1answer
14 views

Add nofollow to custom widget posts

I would like to add the nofollow to my blog links in the custom posts widget. I think it could be done by filtering widget_posts_args but I am a bit lost on how to tweak that function. Any suggestions?...
0
votes
0answers
14 views

How can I change WPML settings programmatically?

I'm trying to change WPML settings programmatically, as suggested in these posts: Disable auto sign-in programmatically Overriding the WPML settings My goal is to disable a WPML's feature that ...
0
votes
0answers
13 views

Changing the “Post Published. View Post” admin notice message after running `wp_insert_post_data` filter

I am running a validation logic for when a user is attempting to publish a post, the validation is made possible using wp_insert_post_data filter. If a user wish to publish a post, the filter will ...
0
votes
0answers
10 views

How to pass custom_field value back to admin editor after field updated by a hook? AJAX? Other way?

I have a custom post type that has custom fields as meta data. The post is a lesson. As part of a lesson I have a webinar_id field. I typically don't edit that field directly, though I could if ...
0
votes
1answer
12 views

SEARCH QUERY PLEASE HELP | call_user_func_array() expects parameter 1 to be a valid callback php

Major issue with my search queries being outputted incorrectly on the blog page with respect to query's. In wordpress admin most relevant listed first but outputted DESC on page. I have this code in ...
0
votes
1answer
19 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
1answer
24 views

ACF for custom post type archive pages: which hook to use?

I'm trying to register ACF options pages for each custom post type defined in the theme: $post_types = get_post_types( array( 'public' => true, '_builtin' => false ), ...
1
vote
2answers
27 views

Hook to change Logout url

I used this hook to replace the exit address . Now, unfortunately, this hook does not work and I can not understand why add_filter('logout_url', 'my_custom_logout_url'); function ...
1
vote
1answer
18 views

Disable block from editor based on post type

I've made a Gutenberg block which is only appropriate to show on hierarchical post types, so I want to disable it from the block inserter for non-hierarchical post types. I thought about how to ...
0
votes
0answers
25 views

Register/enqueue scripts only on certain admin pages

I found this question here but I'm a bit confused on how to proceed. I need to register or enqueue the bootstrap css for my plugin admin menu page. I've understand that when an admin menu page is ...
0
votes
0answers
15 views

Client side pre-save Javascript hook on all admin pages

I'm planning a Wordpress plug-in and new to the process. I have read about admin filters and actions which get executed server side. Is there any way of intercepting admin page submits globally on the ...
0
votes
0answers
8 views

Make category required

I want to prevent a post from submitting if no category is chosen. I don't want them to be automatically in the default category but really force the user to choose a category. I found this question ...
0
votes
0answers
14 views

Right filter for rewriting page statuscode

I am new to developing wordpress plugins. But I am looking to write a fairly simple plugin. I want to write a plugin that rewrites the returned status code based on some logic that consults a ...
0
votes
0answers
15 views

Woocommerce change the shipping method on the checkout page?

On my checkout page, I'm using Loqate to lookup an address and here in the UK I am able to retrieve whether this is residential or business. My intention is to change the shipping rate based on this. ...
1
vote
0answers
40 views

Why is get_post_permalink() giving me an old, outdated slug URL that redirects to the new one?

I have a custom post type, stores in a store locator type web app, with some custom fields. Posts created with that post type get their slug updated to the city name field using a function in ...
-1
votes
1answer
22 views

Woocommerce: block user removing cart item

I've been tasked with creating the most awkward buying process my client could possibly come up with. When buying a product, the customer proceeds to a multi-step process where they build up a ...
0
votes
0answers
17 views

WordPress or WooCommerce hook when order is made, using Bank Transfer as payment

I was wondering if there is a hook I could use to trigger one function in the moment an order is placed, but only if the order is made with payment by Bank Transfer. For the online PayPal payments I ...
-1
votes
1answer
20 views

What is the difference between add_action and add_filter [duplicate]

I just want to know what is the difference between the add_action and add_filter. I just could not get it enough in the documentation of wordpress. Can anyone explain it more broader and simpler. ...
1
vote
2answers
27 views

admin_notices not working in post editor

I'm trying to fire an admin notice from within a pre_insert_term filter (have also tried it as an action). Example: add_filter( 'pre_insert_term', 'pre_insert_term_action', 10, 2 ); function ...
0
votes
1answer
26 views

How to use embed_content hook?

From the document of embed_content: Prints additional content after the embed excerpt. But I don't know which content it will print. Does it take any arguments?
0
votes
0answers
16 views

alter the main query on 404 error page to display content from another page

I have a normal page with content that can be maintained by editors via the backend. Now I want to display this content on the 404 page. So i tried to use the pre_get_posts hook to alter the main ...
0
votes
0answers
18 views

How to track product price changes?

I am writing an API plugin. Every time a product or quantity changes in woocommerce, I need to export a new price to the server. Also in the IPA there is import, which I will conduct through cron. ...
1
vote
1answer
34 views

What are the differences between comment_form_logged_in_after and comment_form_after_fields?

This is a follow-up question to this one. When hooking into the add comment form there are two hooks to use: comment_form_logged_in_after comment_form_after_fields Am I right in assuming that the ...
0
votes
0answers
11 views

Delete certain attachment fields only

I am using formidable and below is my hook code. The code deletes all attachments but i would like to delete only certain upload files . Is there a code that I can modify and add field number to be ...
0
votes
0answers
10 views

Post title only for front/blog page, category, archive, search etc

On any standard blog page dedicated to listing posts (i.e front, blog, category, archive, search etc.), I want to show just the post title rather than the post content. Example of desired output: &...
1
vote
1answer
19 views

Change Password Confirmed Email Text

I've been struggling to find a hook I can use to edit the text in the password confirmed email that gets sent out when you've changed your password in WordPress. Is there anyway to do this with a ...
1
vote
1answer
22 views

How to change image atributes right before an image to be saved?

I have an installed plugin to import XML content, but it can't change some meta-data of the new image that will be saved. For example, I'd like to intercept the action of saving an image BEFORE its ...
2
votes
1answer
18 views

merging an array to an existing array using add_filter

I'm working on a plugin and i want to be able to extend some of the functionality using apply_filters(). I have a setup like this which is the default values; print_r( apply_filters( '...
0
votes
2answers
34 views

Add filter return false not working

simple issue but i need some help because i dont why i m wrong on this... The apply filter (Important, this is in construct Class): if ( apply_filters( '...
0
votes
0answers
22 views

Edit plugin's HTML output with Hooks

I'm trying to edit the HTML output of a plugin, but I'm not sure how to do it properly. This is the code // display the heading $content .= '<h' . $heading_level . ' class="mbm-book-grid-heading' ...
0
votes
0answers
16 views

Hide certain product categories from specific pages

I'm trying to hide certain product categories on specific product category pages on my woocommerce shop page. And I found this code to help me: add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 ...
0
votes
1answer
14 views

How do I ensure I can loop through every enqueued script and CSS?

I'm on a bit of an efficiency drive. To this end, I would like to check all the scripts and CSS that get enqueued on my multisite setup. I plan to check that they are offloaded to public CDNs if ...
1
vote
0answers
24 views

Add other social networks to TwentyNineteen_SVG_Icons class in child theme?

I'm trying to add items to the $social_icons_map and $social_icons arrays in class-twentynineteen-svg-icons.php I know I need to do it in the functions.php file of my child theme. I think I need to ...
0
votes
0answers
16 views

“Meta box” plugin does not save when using classic editor

I am building a plugin, which relies heavily on Meta Box -plugin. Everything works fine, except when using classic editor, ie. with Classic Editor or WP Bakery plugins. Then the changes to the fields ...
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
19 views

Footer.php being inserted before article closing tag?

I have set up a child theme to 2016. I must have done -something- because the footer.php in the child theme is being inserted immediately after the .entry-footer tag (immediately before the closing ...
0
votes
1answer
32 views

Custom filter not working

I am very new to Wordpress Development so this question might be silly .May be I do not understand the concept of custom filters in Wordpress . So far I have used Wordpress's own filter hooks to ...
2
votes
1answer
34 views

Sensei LMS Hooks to Remove Content

The Sensei LMS single-course.php template has this action: <?php /** * Hook inside the single course post above the content * * @since 1.9.0 * * @param integer $course_id * ...
0
votes
0answers
11 views

Hook for validating and rejecting frontend image upload

I am making a plugin that checks the contents of uploaded images. Right now I am testing if I am using the right hook, so I use getimagesize() to check the image (I am aware this is not the best/most ...
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
0answers
20 views

'wp' action not firing in wp-admin/post-new.php?

It seems that the 'wp' action is not fired within the wp-admin/post-new.php page. I would like to hook a function that would run in any case, backend or frontend, as soon as the global $post variable ...
1
vote
0answers
15 views

Showing the WordPress standard text area on a Woocommerce Single Product Page?

I'm trying to show the WordPress default text area on a Woocommerce Single Product Page but can't find the appropriate hook to add to the template? I would have thought it would've been well ...
0
votes
0answers
12 views

Call javascript function when add_attachment hook fires

I want to run a javascript function when the add_attachment hook fires. The following code does not interfere with uploading an image. add_action('add_attachment', function( $post_ID ) { ?> ...
0
votes
1answer
13 views

Hook after all metadata are set is triggering several time

I need to trigger a function everytime the user save the post manually (so only thanks to the "Update button"). Here's what I have : add_action( 'save_post', 'my_save_post_function', 10, 3 ); ...
0
votes
1answer
33 views

What is deprecated_argument_run meant to do exactly?

I found an odd hook in the WordPress documentation. deprecated_argument_run which has this "enlightening description". Fires when a deprecated argument is called. I pretty much figured that much ...
0
votes
1answer
16 views

Does hooking into a plugin action / filter override the plugin's function for that hook?

I have a question about how actions and filters interact with functions: I am currently using an event ticketing plugin for wordpress, there are built in validation rules that is already in the ...
0
votes
0answers
14 views

Transition_Post_Status hook not working properly

When I run this code, the $cptnumber variable doesn't receive the custom post type number when I set a published post to draft. (For example: 367) It works when I trash a post, but not when I change ...
0
votes
0answers
42 views

Hook create / update post

I'm creating an Event thanks to a plugin (Event plus). I need to alter the hook when the event is created, I tried with the native WP functions, but as WP (or the plugin ?) always create an ID for ...
1
vote
2answers
23 views

Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]

I am planing to show a new price on my woo-commerce product page for all products. This is the installment price per month. I need to show this below the normal price (variable price and simple price) ...