Questions tagged [hooks]

Method by which plugins and themes extend core WordPress functionality.

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

Unable to trigger a frontend @wordpress/hooks action

I’m trying to implement a frontend WC block hook, but unfortunately I’m not able to trigger it. I’m using a fresh 8.7.0 install, and blocks are definitely enabled. I’ve tried following the ...
Dylan Pierce's user avatar
0 votes
0 answers
9 views

Custom cart counter breaking checkout process [closed]

H owdy, I'm having an issue where my custom cart counter code is causing the payment fields on a checkout to "dim" and become unusable (the payment interface is reduced in opacity and no ...
adamlaughlin's user avatar
1 vote
0 answers
13 views

Custom filter not affecting gtag script position in WordPress footer

I am using a custom filter to place the gtag script in footer if it is applied in functions.php. The filter code is: if (apply_filters('myplugin_ga_script_position', $position = 'footer')) { ...
ahmedwp's user avatar
  • 21
0 votes
1 answer
14 views

Custom post type template not loading from plugin

I've created a custom post type called jdshs_jobs in a plugin and I have tried to get Wordpress to associate a template (single-jdshs_jobs.php) from within in sub-folder: .../plugins/plugin-name/...
Alex Adams's user avatar
2 votes
0 answers
15 views

get_meta_sql hook is not firing

WP_Query uses WP_Meta_Query. I thought this calls the WP_Meta_Query::get_sql() to define the meta query SQL which is where the get_meta_sql filter is applied. I can't get the get_meta_sql filter to ...
Adam's user avatar
  • 103
0 votes
1 answer
20 views

Redirecting after login except for a specific page

I needed to redirect users after login and this was not a problem using an add_filter on functions.php, done, it works as expected. But now I need to avoid this redirect when the user login from a ...
zatarra's user avatar
0 votes
1 answer
16 views

‘At a Glance’ dashboard: combining infos

I add a hook on at a glance dashboard for custom posts and it runs ok. If i add a count users and an other for each, I lost the post_type info. Also the //second is working well if the //first is over ...
made leod's user avatar
3 votes
1 answer
51 views

"Invalid parameter(s): attributes" issue in context of "blocks.registerBlockType" filter

The goal I'm working on a plugin that adds classes and attributes to any block. On the frontend the blocks are animated using JS and CSS. It basically works, but... It seemed to be working fine with ...
beat's user avatar
  • 43
0 votes
0 answers
17 views

Customize WP Filter Hook

I am using WP Form Locker Add-on Plugin. When you confirm your email the plugin sends you email with verification link. The email reaches in English. I want to make it reach in Arabic This is the ...
Zoro's user avatar
  • 1
0 votes
1 answer
26 views

How to customize password reset message page on success if no error in password reset

I tried login_message filter with $_GET['action'] && resetpass but I want it on success password message page.
Wordpress developer's user avatar
1 vote
2 answers
65 views

How to run this plugin every time a post is saved?

So far this is what I have... I'm new to developing plugins so I'm not sure how to make a plugin run code on a post save. I know that this would likely work if it was added to the post.php page but I ...
Cody King's user avatar
0 votes
1 answer
23 views

Replacing specific Gutenberg blocks

I was wondering if there is any way to: replace a Gutenberg block (in this case the navigation), with ESI, + fetch this block in another endpoint the ESI tag points to. In classic themes this is ...
WpToon's user avatar
  • 1
0 votes
1 answer
35 views

How to disable publish_future_post auto add wp_options cron

My website >> database >> wp_options >> option_name >> "cron" field total size 31GB (I was so surprised @@) After checking i see a lot of publish_future_post fields ...
Công Tử Huyết's user avatar
1 vote
0 answers
10 views

Adding custom filter not working

this maybe a stupid question, when I’m trying to create a custom filter to hook into later and filter and return something, I don’t get any results. I am testing this in the themes functions.php //...
Aldo's user avatar
  • 11
1 vote
1 answer
15 views

Add a post when another post type is inserting

I want to add a product when service post type inserting or updating. Below is the code. It works but it keep generates products while the code executing. What is the wrong with this code? add_action( ...
Avijit Palit's user avatar
1 vote
0 answers
26 views

Core/Image access caption in render_template and in wp.hooks

I am making an override to core/image block -disabling styles, changing markup and such. I have managed to solve some things, but struggle with some others. Here is my code: filters.php <?php use ...
Sam Tyurenkov's user avatar
1 vote
1 answer
87 views

useSelect() plus resolver result is serving cached data incorrectly

Well ok, it's probably not incorrect that the data is cached, but it's not what I want to happen. But I am stuck on how to correctly set up my custom data store the way I need. I'm trying to set up a ...
helgatheviking's user avatar
1 vote
0 answers
26 views

Preview for revision?

Is this possible: to allow admins to preview revisions from revision history, either with a plugin or hook? I would like to allow the admin to view post and page revisions, without having to restore ...
Jillian Hoenig's user avatar
1 vote
0 answers
47 views

Responsive images, per image type?

I am new to understand responsive images. Unfortunately the resources out in the internet did not help me to fully understand the concept, so please bare with me. I would like to know hdavidow if it ...
kocjs's user avatar
  • 23
0 votes
0 answers
23 views

Hook to Use Second Field Before Fallback

I'll provide background below, but the TLDR is that I can't find the right field/function to insert the post title at the <need_something_here> in the code below. if ( ! function_exists( '...
CWeinhofer's user avatar
1 vote
0 answers
26 views

HowTo modify BlockEdit-Component in Filter-Hooks for core-block Extensions

I've had a problem blocking me for days... I have extended the core block 'core/group'. The extension inserts an (overlay) div into the container and wraps the InnerBlocks into another div so that the ...
Jürgen's user avatar
  • 11
0 votes
2 answers
82 views

Function attached to cron job not running but will run if called manually

I have a cron job set up with the following code in my functions.php file I have a CPT with a custom field that defines an expiration date for each post. All I am doing is checking if the date has ...
grzybowski1911's user avatar
0 votes
0 answers
43 views

How to short circuit a wordpress query that is not related to posts?

How to short circuit the below query via hooks such that the query is not run based on a condition? I tried using pre_get_posts filter but that is for posts queries only. The query runs as a part of ...
dc09's user avatar
  • 195
0 votes
1 answer
40 views

hook on the_excerpt

I would like to have the excerpt length formatted + [...] and then keeping the 'read-more' as a button. I was able to hook the 'excerpt_length' from 55 to 25 and that was fine: function ...
made leod's user avatar
0 votes
0 answers
15 views

Is there a hook for updated image metadata upon using image editor?

When a user uploads an image, I am able to use the wp_generate_attachment_metadata hook to know about all the thumbnail locations. When I use Wordpress to Edit Image (to scale, resize, etc), I can not ...
Dave Stein's user avatar
0 votes
0 answers
10 views

Can I know what changes happened after using native Image Editor?

If someone uses the WP Image Editor, I want to know what edits were done. I tried out some simple sample code like this: add_filter( 'wp_save_image_editor_file', 'after_edit', 10, 5 ); function ...
Dave Stein's user avatar
0 votes
0 answers
35 views

Why wordpress doesn't allow to add author filter to media library page in grid mode

It appears that Wordpress doesn't allow to apply new author filter to upload page (upload.php) in "grid" mode. If it's right, why? If not, does it exist a specific hook/function to allow ...
imagIne's user avatar
  • 53
0 votes
1 answer
23 views

Webhooks - Differ between new/existing updates

I'm currently trying to work with webhooks without using any plugins, and I'd like to avoid them if possible. The webhook should be triggered when a change is made to the Custom Post Type "event.&...
Björn's user avatar
  • 1
0 votes
0 answers
34 views

Wordpress Action Hook inside Classes

The WordPress plugin is functioning correctly, and within the functions.php file, I aim to establish tabs using arguments and hooks. These tabs should consist of both a tab menu and tab content. ...
aldin_abdagic's user avatar
1 vote
0 answers
30 views

Appropriate WP hook to use set PHP cookie

I'm trying to set cookie in init hook. add_action( 'init', 'sa_maybe_set_cookie' ); function sa_maybe_set_cookie() { if ( ! empty( get_option( 'sa_allow_cookie' ) ) { setcookie( 'sa-...
micky's user avatar
  • 113
0 votes
1 answer
25 views

I only want to show links to categories that have posts in 'publish' state in my menu

I am working on a WordPress project where I want to dynamically filter menu items (and possibly their parent items) based on whether they are associated with any published posts. Specifically, I am ...
DiaJos's user avatar
  • 101
0 votes
0 answers
39 views

Skipping all WP functions for a cached version

I started making the following caching codes in order to create an experimental plugin that provides a solution to my own needs. add_action('wp_loaded', 'buffer_start'); add_action('shutdown', '...
G.D.i's user avatar
  • 23
0 votes
0 answers
37 views

Add 2 links in between the navigation using the Breadcrumb Navxt plugin hook

I am using the Breadcrumb NavXT Plugin. I have 2 links at a page, and want to add 2 more links in between on that specific page. I used the below hook, but did not get the result. add_filter('...
Rizeen's user avatar
  • 101
0 votes
1 answer
29 views

Does a wordpress custom plugin is fired by default on php theme ajax request?

Inside My custom wordpress plugin to translate all posts depending on get_locale() I created a php file that's add_filter() to each post content element. Ajax requests are called from functions.php ...
imagIne's user avatar
  • 53
0 votes
0 answers
11 views

How to modify username before logging in?

I know a solution exists for Wordpress admin from this Stack Exchange question: Change username before login However, while this works for logging into Wordpress directly, I am trying to use it for ...
Harish Prabhakar's user avatar
0 votes
0 answers
53 views

How do I modify the TinyMCE editor Add Media button to insert a thumbnail preview of PDFs in addition to a text link?

We're still using TinyMCE as our post editor. When Editors use the 'Add Media' button to select a PDF from the Media Library, they choose the preview image from the Attachment Display Settings at ...
jchwebdev's user avatar
  • 765
0 votes
0 answers
13 views

filter hook 'authenticate' runs twice

I am writing a custom function for logging into wordpress multisite. I take the name of the site via blog_id and append it to the username then pass it into 'authenticate' filter hook. Eg) Username ...
Harish Prabhakar's user avatar
0 votes
1 answer
31 views

Is there a way to assign a default Category to a Post when the user creates a new Post?

So far the best I've been able to figure out is how to assign a category when the Save Draft button is pressed. That is not what users want. They want to a particular Category ticked when they first ...
jchwebdev's user avatar
  • 765
0 votes
1 answer
721 views

Custom fields in the billing address section woocommerce

I have added custom fields in the billing address in Woocommerce checkout page, this works fine. Now I would like to show these custom fields inside the "billing address" box in the email ...
LesCa's user avatar
  • 21
0 votes
0 answers
37 views

Search with synonym letters for arabic language

How can I have WordPress search different letters in Arabic? For example, أ-ا-إ are the same letters but in different formats. E.g. can I search WordPress for something like "world" > &...
AbuKotsh's user avatar
0 votes
0 answers
32 views

woocommerce new order alert on a specific non admin page

I'm relatively new to WordPress but have basic understanding of how it works; I have a page where non admins can see woocommerce orders, I want to trigger a popup on this page when there is a new ...
petey's user avatar
  • 1
0 votes
0 answers
22 views

How to add "Leave a Comment" link or button at the bottom of each post in the "Latest Posts" block?

I have been digging around in WordPress developer resources to see if I can figure out how to add "Leave a Comment" link or button at the bottom of each post in the "Latest Posts" ...
bistromatic's user avatar
0 votes
0 answers
78 views

What hook runs wpautop on template content?

I have a shortcode that outputs HTML and I've inserted it into a single post template. The output gets extraneous <br/> and <p> tags, which I've read in other topics are likely due to ...
Aayla Secura's user avatar
1 vote
0 answers
58 views

Ship block templates or block template parts with plugins

Using the following code one can ship CLASSIC PHP templates for custom post types registered in plugins. An example for a custom post type named MOVIE: function my_template_include( $template ) { ...
leemon's user avatar
  • 1,898
0 votes
0 answers
23 views

Is there a wrapper to develop a plugin for WordPress and Prestashop in generic code?

I'm looking for a wrapper or other tool that lets me develop a plugin for both WordPress and Prestashop in one go. So that I can write generic code to create a page, and have hooks to run on page load ...
Lode's user avatar
  • 101
0 votes
1 answer
157 views

Remove H1 title in admin post edit screen

As a priority i need to just display some custom html inside the Title(h1.wp-heading-inline) in the Post Edit Screen (Top Left Corner). While trying various methods i found that all html is filtered ...
Ion T's user avatar
  • 15
0 votes
1 answer
33 views

Why does my function create extra empty files?

The code below, added to functions.php, is saving the texts (pre-formatting) of the posts when they are saved, published, or updated. During the first run, I also added save_all_post_to_database() to ...
Yulia V's user avatar
  • 115
0 votes
0 answers
104 views

WordPress Backend - Custom Login Flow

What do I want to achieve : Login based on the mobile number and OTP each time the user logs in, an OTP will be sent to his number. The OTP service is linked to an external server, meaning that, I do ...
sayo's user avatar
  • 1
0 votes
0 answers
59 views

How to add field new in account bacs in woocommerce?

i was looking for a way to add a new field to woocommerce bank account info, my theme has no child theme and i put my code in functions.php I found the solution but it doesn't work. function ...
Le Xuan Phat's user avatar
2 votes
1 answer
110 views

At what stage does wp_ajax hooks gets applied during Wordpress request?

At some point between muplugins_loaded and shutdown wp_ajax_*, wp_ajax_nopriv_* are executed, but where/when exactly? I have found that this is working: add_action( 'wp_ajax_actionname', '...
Miloš Đakonović's user avatar

1
2 3 4 5
46