Skip to main content

Questions tagged [hooks]

Method by which plugins and themes extend core WordPress functionality.

Filter by
Sorted by
Tagged with
4 votes
1 answer
86 views

Getting fatal error when using manage_media_columns filter of WordPress

When I am using manage_media_columns filter of the WordPress I am getting the fatal error. This is the code I have added in my functions.php file. add_filter('manage_media_columns' , 'book_cpt_columns'...
Ashok Kumar's user avatar
1 vote
0 answers
14 views

Woocommerce: hide “Price display suffix” when the VAT is zero

is there a way to hide the “price display suffix” of the products when the VAT is zero? (I’m currently doing some test on a local test site). For example, the shop is set in Germany, the products have ...
Dande's user avatar
  • 35
0 votes
1 answer
18 views

How to Dynamically Switch WordPress Front Page Without Causing Canonical Redirect?

Question: I'm trying to dynamically switch the front page of my WordPress site based on certain conditions (e.g., whether a user is logged in or not). I have two specific pages that I want to set as ...
Dejan Dozet's user avatar
1 vote
1 answer
35 views

WooCommerce Webhook Action When a New Product Review was Submitted/Created

I'm looking for a WooCommerce action hook, whenever someone submits a product review via the review/comment form. Can't find anything about this in the documentation or web. I like to trigger a ...
Bert Kößler's user avatar
0 votes
1 answer
49 views

Is there a way to pull remotely generated XML, process it, and display it on a Managed WordPress page?

Note: This is cross-posted on stackoverflow. I need to get some XSQL generated XML data from a remote server, process it, and display it on a GoDaddy Managed WordPress page. (This is the website my ...
Giric Red Wolf's user avatar
0 votes
0 answers
15 views

Wordpress : how to create onglet and remove it when only one

I have two extensions : Core where there all the common files and Wooster extension in Wordpress. In Wooster extension I have WoosterPartnerSetup.php and in the Core WoosterSetup.php. I am trying to ...
OceaneEMILE's user avatar
0 votes
0 answers
13 views

Add "New" Sale badge to products in WooCommerce based on creation date

I tried to add the label "new" to products created within the last 30 days by adding an action to the "woocommerce_before_shop_loop_item" hook. However, it's not working. function ...
Harry Nguyen's user avatar
0 votes
1 answer
19 views

Show admin notice if metabox field is empty during save post

Who can help me a little. I try to get an admin error notice if a metabox field is empty during save post. Wordpress refresh the page after saving so the hook admin_notices does not work. Here is my ...
RickB's user avatar
  • 1
0 votes
1 answer
55 views

Prefix user login_name and validate it is unique on Registration

I want to add a static prefix to each new user who registers. I do it using the pre_user_login hook Example: function prefix_user_on_registration($username) { if (!str_starts_with($username, '...
mr.d's user avatar
  • 121
1 vote
0 answers
19 views

change the time of the default wordpress crons

In WordPress this are some default crons as shown in the below image how can we able to update the default time of this crons for next run? Can we change using any hook ? Also can we change using WP-...
Dev Thakkar's user avatar
1 vote
0 answers
37 views

Wordpress as microblog: show excerpt instead of "(no title)" in posts view

I am using WP (currently v6.5.3) for cross-posting to micro.blog/Mastodon/Bluesky (and occasionally manually posting the items to X or Threads). As such, my posts rarely have titles, which makes it ...
Andrew Jaffe's user avatar
0 votes
1 answer
30 views

The enqueue_block_assets is changing the styles of the editor interface

I am ensuing stylesheets that are supposed to be used by a theme in the iframe from the editor and on the front end. Some of the css contains styles for html tags such as H1, H2 etc.. body { ...
Walrus's user avatar
  • 131
0 votes
1 answer
29 views

How to check if we are in the init hook?

I am developing code which should throw an exception if called before init. Is there a way to check if we are in the init hook or past it?
inf3rno's user avatar
  • 135
1 vote
0 answers
35 views

What is this async request in wordpress

There is an issue appearing with high admin-ajax async request can anyone explain what this does, what this request is? we have seen this multiple times but could not possibly debug or explain what ...
Hamza Mohammad Khan's user avatar
0 votes
0 answers
8 views

update ACF field when saving post on back office

I am trying to update the value of a custom field (order) inside a POST when it is saved on the back office. If my status is Sold, I want the value of order to be 3. Everything is working smoothly ...
david simon's user avatar
0 votes
0 answers
15 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
1 vote
0 answers
16 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
65 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
18 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
25 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
24 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
83 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
19 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
54 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
96 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
50 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
59 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
11 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
22 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
46 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
128 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
30 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
49 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
24 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
39 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
108 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
47 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
56 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
23 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
47 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
  • 83
0 votes
1 answer
35 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
36 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
35 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
26 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
47 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
46 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
31 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
  • 83
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
63 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
  • 775

1
2 3 4 5
47