Questions tagged [hooks]

Method by which plugins and themes extend core WordPress functionality.

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

Woocommerce get_term_by() in transition_post_status hook doesn't works

Im having this code $concours_termine_cat = get_term_by('slug' , 'concours-termine' , 'product_cat'); get_term_by is returning false, after debugging the get_term_by function taxonomy_exists( '...
0
votes
0answers
10 views

Limiting search to html heading tags

Is there a way to limit the Wordpress search function to only search among headings (as in <h1> to <h6>)? Or, ideally, to search among headings and post titles? I basically want to exclude ...
0
votes
0answers
5 views

My total checkout is not the same than my total cart [closed]

i'm trying to create an estimate form plugin on wordpress using woocommerce. I'm able to get the total price of my form on my cart but not on the checkout page. The value "prix" diseappear ...
0
votes
1answer
15 views

I would like to send a notification email (Asana) whenever something is published (posts, pages, custom post types) [duplicate]

The code below works perfectly When I create a new post, an email is sent out to the email included in the function. I would like to know how I can send an email when anything is published on the ...
0
votes
1answer
42 views

Use wp_head hook on template page

I try to use the hook wp_head on a template page but this does not work add_action('wp_head', 'to_head'); function to_head(){ //do stuff } I placed this code on a template part what is called by ...
0
votes
0answers
9 views

How to make a preloader to avoid flickering effect for my plugin?

I developed a WP plugin that displays a full screen content chat. Problem is: the post that includes that plugin first displays the content and then the plugin : that creates a nasty "flickering&...
0
votes
1answer
18 views

How to change footer credit text in Twenty Twenty One theme with a hook?

If I want to change the footer credits, I would usually copy the footer.php to a child theme and edit the following snippet: <div class="powered-by"> <?php printf( /*...
2
votes
2answers
25 views

enqueue hover function

I am trying to enqueue a hover function in my functios.php of my child theme, so that when hovering over a title, a div with a text will be visible. The code I am using is this: <?php add_action( '...
0
votes
0answers
9 views

Custom script/iframe after “Add to Cart” in WooCommerce for every product

I need to add a custom script/iframe for each product on a WordPress/WooCommerce site. I want it to show after the "Add to cart" button. I know I can use WooCommerce Hooks to perform this ...
0
votes
2answers
98 views

Add a counter beside menu item label

I'm using the following code to add a panel to the admin menu screen, so the users are able to add a Cart link to their menus: function my_add_meta_box() { add_meta_box( 'custom-meta-box', __( '...
0
votes
1answer
6 views

Add stuff above header edit form

I am searching for a hook that gives me the opportunity to add some stuff above the heading line in the edit page. I found these hook but this place some stuff between the heading and the title. ...
0
votes
0answers
18 views

Add content in cpt archive page

I am trying to add some custom content hooked into custom post type archive page but I can't. I have already achieved it in single page with: add_filter( 'the_content', 'yourprefix_add_to_content' ); ...
0
votes
1answer
29 views

Add html tot CPT edit screen - no metabox

Which hooks can I use to add my own HTML stuff to a CPT edit screen? I created an own CPT with $args = array ( 'labels' => array ( 'name' => 'Catalog', ), '...
0
votes
1answer
24 views

Set default value for “Additional CSS class(es)” for specific block types

For the columns block type, I'd like to add in a default value of wp-block-columns--padded in the "Additional CSS class(es)" field, the idea being that the user could remove or modify the ...
0
votes
0answers
39 views

add blacklist moderation list inside pre_comment_approved filter plugin

i am using Comment Whitelist plugin to create a whitelist of email domains for autoapporing comments. It seems that the plugin overrides wordpress : Settings->Discussion options->moderation ...
1
vote
1answer
23 views

Convert HTML Script to Shortcode [closed]

I want to convert this code into a shortcode from the Code Snippets plugin, I have seen an example come up but when I put it it does not work, the example is the following: add_shortcode( '...
0
votes
0answers
12 views

'wp' action hook not firing in admin and login?

I need to register an action via add_action('wp', function(){...}); The action works in frontend, but in backend and login page it doesn't work. It seems as if 'wp' hook doesn't exist for ...
0
votes
0answers
16 views

How Do I Modify the Post/Page Query used by the REST API?

I'm attempting to develop a simple access control plugin for WordPress which controls who has access to each post/page. I have used the template_redirect hook to check whether each user has access to ...
0
votes
1answer
20 views

Alternative Hook to the_content for Changing Background Color

I'm brand new at writing WordPress plugins and have tried to find which hook would be appropriate to use when changing the background color for front-end pages. I've tried the_content, stylesheet, and ...
0
votes
0answers
10 views

show it to members when there is a new post

I prepared a code, it works when there is a new post, but how do I show users that it is +1 each time a post is made, and if the user clicks on the list of posts, it will be deleted, then it will ...
0
votes
0answers
9 views

Alter the page title with a hook, without altering navigation links

I've written a basic function with the goal of altering the page title. It works. However, the new string also replaces every single navigation menu item on the page. At first I thought that might ...
0
votes
0answers
15 views

Custom field for Dokan booking product

Hi I have found a page (https://nayemdevs.com/how-to-add-a-new-field-on-product-upload-form-dokan-multivendor/) that shows a code to add, edit and show custom field in Dokan but it doesn't work on ...
3
votes
2answers
114 views

How to check if which hook triggered the call to a function?

I have a situation where I have a function hooked to more than one custom hooks. How to check in the callback function which custom hook triggered the call? Or the question in code will be add_action('...
0
votes
1answer
15 views

Add WordPress hook outside of Plugin or Theme

We have the following code that is used to hide our core theme so that it can't be enabled directly and you can only enable the child themes from the WordPress Dashboard. function hide_core_theme($...
0
votes
0answers
22 views

Wp_Schedule_Event every few minutes doesn't work

I wrote the folowing timer in my function.php file. It should be called every certain time (3 minutes) but it doesn't work at all. function myprefix_custom_cron_schedule( $schedules ) { $schedules['...
0
votes
0answers
11 views

What's the hook for modifying the html code added by Wordpress via Add Media Insert from URL?

Does anyone knows the Wordpress hook used to modify the HTML code generated by WP's Add Media -> Insert from URL -> Insert Into Post function. To clarify myself, let's say I want to add a media ...
0
votes
1answer
42 views

How to hook code in <body>?

In the question How to add code to Header.php in a child theme?, a recommended solution is to create a plugin, then hook into wp_head action by using this code: add_action('wp_head', '...
2
votes
2answers
137 views

Hooking new functions to actions + passing parameters

I am trying to understand some fundamentals of php with regards to adding new functions to actions. I found a tutorial where he adds a new function to the save_post action… add_action('save_post', '...
1
vote
1answer
35 views

Using wp_editor tinyMCE in metabox cause form alert on leaving page

Using tinyMCE as wp_editor in a custom post type metabox create an alert when I try to submit or If I want to change location I don't have such behavior using Quicktags, but since TinyMCE is easier ...
0
votes
0answers
19 views

Unpublished Pages Failing To Appear On Custom Path

The Context I have a domain, we'll call it example.com, where traffic travelling to this domain first hits a reverse proxy and depending on the path it is directed to two different containers. Traffic ...
1
vote
0answers
22 views

Map a custom id to wordpress post id

I am new to Wordpress and wondering what the best way might be to go about doing this. We have a requirement to map our own id (known as friendly_id) to the Wordpress's post id. The idea is to import ...
0
votes
0answers
28 views

Struggling with plugin dev basics: add_action

I've done a lot of reading, but I'm just really struggling to get my head around it. I am trying to write a plugin that catches User Registrations/Password changes/deletion and subsequently update a ...
0
votes
0answers
26 views

Store user ID on wp_term_taxonomy when new term inserted

I've added a new column called term_author to the wp_terms table to store which user is inserting each term. Before a term is inserted, I've added a filter to insert the user ID, but although I'm ...
1
vote
1answer
115 views

Randomise upload filenames (or another solution to hide the original image URL from theft?)

Our users upload high resolution artwork that we need to protect from theft. The images are resized and watermarked, but it's still trivial for somebody to guess the original URL and gain access to ...
0
votes
1answer
26 views

How can I change the date format of the revision list?

The date format looks like this "$ datef = _x ('F j, Y @ H: i: s', 'revision date format');" but I want it to be like this "$ datef = _x ('Y-m-d @ H: i: s', 'revision date format');&...
1
vote
1answer
32 views

WP CLI Get all Enqueued Scripts and Styles

Normally, I would hook into the wp_enqueue_scripts action in order to gather a list of enqueue'd scripts and styles. However, I have a very intensive process I need to run, thus instead of running it ...
0
votes
0answers
29 views

add a hook of Woocommerce to a plugin but it only shows and doesn't function properly

I have this plugin for my site that can verify OTP. It shows and works perfectly on the registration page. I wanted to add the exact same field to my checkout register. I've added the hook of ...
0
votes
0answers
15 views

Add HTML to custom post type edit page

I have searching for adding HTML to a CPT edit page on the admin side. On the internet I see a lot about metaboxes but not about adding your own HTML stuff. Is there somebody who knows more about this?...
0
votes
1answer
51 views

RTrouble passing arguments to action

I know there are several posts on this topic. I have followed many of them as well as other resources on the web and thought I had it down, but it does not seem to be working. In my case, I have 2 ...
0
votes
1answer
17 views

How to hook add_action() into after category description with id?

I'm using newspaper theme for my web blog. I want to create post highlight into certain category. For example in this url: https://blog.bookingtogo.com/category/destinasi/wisata-domestik/pulau-bali/ I ...
0
votes
0answers
9 views

Gutenberg - Add align controls to a custom block

I want to add align controls to a custom block. I wrote this code thad adds the code that adds the default block alignment toolbar to the block, but I select and change the align, I get an the ...
0
votes
0answers
38 views

Hook event for upload image in the menu

I have to add the image in my dropdown. I know I can do this with CSS Classes (optional) but I don't want to do this. I want to add dynamically instead of open the code and change or add it. What I am ...
0
votes
0answers
16 views

Wordpress Loop Post with comments in homepage (Elementor)

I have a elementor + elementor pro wordpress website. I use elementor custom skin to post a loop in my homepage the screenshot show the loop the things I want to do is comment with the select input ...
0
votes
1answer
14 views

How to use the pre_option filter before a plugin loads?

How would I go about overriding an option using the pre_option_ filter before a plugin loads? I am trying to do something like the below, but I can't do it in the wp_config file, because the ...
0
votes
0answers
17 views

Add_filter in an included file doesen't works

wordpress noob here. I've defined some add_filter to woocommerce function in an included file, but it doesen't seems to be "fired". Here's my code: function.php add_action('wp', '...
0
votes
1answer
30 views

Callback hooked to post_updated firing on new posts as well

Context: I'm using a plugin that allows me to add author boxes throughout my site (Simple Author Box), while providing an easy way for any user to update their social media links and profile pictures. ...
0
votes
0answers
28 views

Add two button to page and post admin to redirect to : add new & list of (posts - pages) just after saving post or page

I would like to add some extra button inside post and admin page creating plugin or adding hook inside functions.php. The image below resume all I want : (1) depending to we are on wordpress post or ...
1
vote
1answer
149 views

Use useSelect/useDispatch instead of withSelect/withDispatch

I've built a Featured Gallery component for Gutenberg that uses the withSelect and withDispatch higher order components to store the selected images in a meta field. I'm wondering if this code can be ...
0
votes
0answers
11 views

Is there a hook that fires after an ajax call?

I'm looking for a hook that is fired before the Ajax content is returned. The reason is that I want to extend the cookies with the Secure attribute I need. Unfortunately is the plugin (woocommerce) ...
0
votes
0answers
20 views

What is the hook for custom category bulk edit?

I have added bulk action in the WooCommerce product category edit. I just want to know what the hook is when I click on Apply to do some actions on selected categories. (Specifically, I want to update ...

1
2 3 4 5
42