Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [actions]

A name for an event that is executed at specific points throughout the WordPress core.

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

Submit CF7 form programmatically with WP-Cron?

We need to check daily if our CF7 form is working properly (form submission data arrives to support's email). So i need a way to programmatically submit the form on frontend. I tried with WP-Cron but ...
Ion T's user avatar
  • 25
0 votes
2 answers
69 views

How to change content hash value, within the_block_template_skip_link action?

When my WordPress site loads up, towards the top, I have something that is generated in the DOM.... <a class="skip-link screen-reader-text" href="#content">Skip to content<...
klewis's user avatar
  • 857
1 vote
1 answer
19 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
0 votes
0 answers
12 views

I am trying to implement some logic on real time order sync using scheduler

I am trying to call a function using the scheduler, wp_schedule_single_event, it is successfully scheduled but the function related to the hook is not called.
Kapil Sharma's user avatar
0 votes
1 answer
74 views

index.php file shown when trying to load wesite

I am trying to make a website as a task for my university. I used this tutorial: https://ubuntu.com/tutorials/install-and-configure-wordpress#1-overview the first time I did it it was fine , but I ...
Giannis's user avatar
0 votes
1 answer
85 views

Execute wp_after_insert_post after the permalink is customized

I'm trying to set a meta property to a new post's permalink using update_post_meta. When I run this on wp_after_insert_post I get a permalink that ends in "?p=[ID]". If I update the post to ...
Tim Troiano's user avatar
0 votes
1 answer
27 views

How to use add_filter to add the extra data to existing array?

Hi I am new to hooks and have a query to add additional data to the existing array. Please check the below code. I have some basic details and want to add the Phone number using add_filter(). If I ...
Manikandan's user avatar
0 votes
0 answers
18 views

disable a specefic sidebar when user is log out

I want to disable a profile sidebar when users are logout if (is_active_sidebar('profile')) : if ( is_user_logged_in() ) : dynamic_sidebar('profile'); else : dynamic_sidebar('--...
D.JCode's user avatar
  • 201
0 votes
2 answers
97 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
1 answer
63 views

wp_update_post breaks my function

Good evening! I'm trying to adjust the post title + some ACF fields after a user have submitted a custom post type ('booking'). The function I've created almost works! The only problem is that ...
joxyzan's user avatar
  • 13
0 votes
0 answers
20 views

How to enqueue additional scripts and styles after loading another post into the DOM?

If have a post_showcase shortcode that takes in post_ids as parameters. The shortcode generates buttons that when click will load the given post into a modal. However, the shortcodes within the ...
Gus Beringer's user avatar
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
0 votes
2 answers
54 views

Too few arguments - wp_login action

I'm looking for a way to avid that some custom users roles are able to see wp-admin dashboard. I've found this topic and in my plugin class I've tried to use the two action suggested, but I will get ...
ICTDEV's user avatar
  • 133
0 votes
1 answer
37 views

wp_head filter not executed inside custom class

I have this code in a simple plugin that is supposed to make wordpress unbranded: <?php /* * Class to remove wp-* branding from WordPress * @package users-manager.php */ class WpUnbrand { ...
ICTDEV's user avatar
  • 133
0 votes
1 answer
32 views

add_action() not working for admin

Making my own custom plugin and using add_action several times without a problem with one exception. Currently function below are located in functions.php in the appropriate themes folder. function ...
PerK's user avatar
  • 28
0 votes
0 answers
40 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
-1 votes
1 answer
78 views

Wp redirection doesn't not change url in browser

I'm writing a WatuPro plugin customization. I need to redirect users to specific url when an exam is completed. I have to do it by code because i need to attach some dynamic get parameters to the ...
user31929's user avatar
  • 101
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
72 views

Unable to correctly logout after changed wp-login.php

I've followed a guide on internet that suggested how to change the wp-login.php page to something custom by modifing the wp-login.php file itself and by renaming it. I've copied the wp-login.php ...
ICTDEV's user avatar
  • 133
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
47 views

Disable RSS /feed/ endpoints on posts without disabling RSS overall

I recently found that Google Search Console has picked up the RSS links for the individual posts and pages on a client site and is attempting to index them. For example, https://example.com/this-is-...
kevinmcgillivray's user avatar
0 votes
1 answer
54 views

Add custom button to the changeset status in the Customizer

I would like to add custom button to changeset_status in the Customizer actions. Any idea how can I do that? Thank you.
Victoria Lievikova's user avatar
0 votes
0 answers
596 views

How to use render_block filter in Gutenberg when editing a page?

I am trying to add new content after updating a page. I've tried the code below, which doesn't seem to have any effect. I've tried core/paragraph and core/code in the if statement below but still no ...
user1448031's user avatar
1 vote
1 answer
355 views

Why does add_action() not run when placed in register_activation_hook()?

I have questions about executing add_action() in a Wordpress plugin. I was attempting to insert into the tag via the plugin i wrote. I had this (which never ran, btw) function tt_add_GA4_header() { ...
extensa5620's user avatar
0 votes
1 answer
34 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
1 answer
71 views

How to get variable from other function inside class function using add_action for Ajax call

I want to access to variable "$sha256" from one function in other one that use both of them an add_action for Ajax call. I read that I must use a class function and add add_action with ...
imagIne's user avatar
  • 83
0 votes
2 answers
211 views

Is there a hook that I can use when a fatal error occurs?

Ideally I would like to log the user or page that triggers a fatal error so that I can follow up with that person or go directly to the page they were on for testing. My thought is that if there is an ...
Aristocles's user avatar
0 votes
1 answer
77 views

How do I set a custom post type Category after import using wp_set_post_terms

I'm importing Events from a Salesforce Event Manager into WordPress, specifically into the The Events Calendar. The Events Calendar creates a CPT called Events. It also has its own Categories, which ...
Mikey B's user avatar
0 votes
1 answer
102 views

Hooks to trigger a callback when adding, removing, rearranging or updating a widget in the widget area

I am looking for hooks that fire when inside of Appearance -> Widgets: A widget gets added to a widget area A widget gets deleted from a widget area Widgets are being rearranged to new positions A ...
Kevin M's user avatar
  • 143
4 votes
1 answer
160 views

delete_term is not working properly with add_action()

delete_term is not working, I'm trying to delete term and after I deleted it, it'll also delete the similar term from different a taxonomy based on their slugs here's my code of the delete_term, so in ...
agent abstract's user avatar
0 votes
1 answer
378 views

How to sort custom sortable column by custom table value

I have a custom table with data in it that I am showing in a column. I would like to make this column sortable. Lets say that the custom table has three values for the sake of simplicity. row_id, ...
BlenderTutorials.org's user avatar
2 votes
2 answers
255 views

Theme's featured image option is not showing up

I'm new to WordPress development. I watched a video on how to add featured images. For some reason it's not working, and I can't really figure out why. The option for featured image is not showing at ...
Dorcas's user avatar
  • 23
4 votes
1 answer
727 views

Is there any filter or action hook to remove layout classes from appearing in my templates?

With the new WordPress 6.1 core update, my site is now having a is-layout-flow class added to the layout. Normally this wouldn't be a huge issue. However, we are using the WP API to feed the content ...
zeropsi's user avatar
  • 101
0 votes
1 answer
80 views

HELP: Code To Check Status And Write Debug Entry

I use a simple function to send out a 'heartbeat' to a website uptime monitoring service (Better Uptime): function my_better_uptime_heartbeat() { wp_remote_get( 'https://betteruptime.com/api/v1/...
David Adams's user avatar
0 votes
0 answers
210 views

How to change wp-admin and wp-login urls

I need to have a custom login url for a wordpress website that will use an headless theme to show a registration form. I've tried using the login_url filter but the result isn't really what I was ...
devdev's user avatar
  • 1
1 vote
1 answer
365 views

Use add_action to run a script, but only on the post editor page

My JS script runs on every page, but I want it to run only on the post editor page. function sm_validate_title() { echo " <script> console.log('script working') ...
MrFacundo's user avatar
0 votes
1 answer
59 views

Hook automatic_updates_complete to autoupdate plugin

I'm trying to trigger some internal update class when WP is autoupdated. For manual update (when clicking on update), I found a way, it's pretty well documentated, I use the hook add_action( '...
JCV's user avatar
  • 21
0 votes
1 answer
215 views

Can you call a filter hook by "add_action"?

I'd think you can't. But I come across this code in a plugin's file: add_action( 'render_block', array( $this, 'render_block' ), 5, 2 ); public function render_block( $block_content, $block ) { ..... ...
shenkwen's user avatar
  • 131
1 vote
1 answer
94 views

My wp_update_nav_menu action is firing twice

i am trying to setup a wp_update_nav_menu action in a Plugin. Now I wonder why this is firing twice. I want to update all my pages with this hook in a headless wp implementation. And this double ...
Friedrich Siever's user avatar
1 vote
1 answer
477 views

Webhook: save_post action fires wp_remote_post twice

I am trying to implement a webhook in a plugin which should fire everytime a user saves a post. It works fine, but I recive two requests on frontend api. The first request has got a wrong slug. I ...
Friedrich Siever's user avatar
3 votes
0 answers
187 views

Is there a way to prevent wp_head from outputting self-closing tags?

I'm a beginner in WP development, so maybe I'm missing something obvious. Is there a way to prevent wp_head from outputting self-closing tags? Here are two example lines taken from my website: <...
Kerans's user avatar
  • 31
0 votes
1 answer
331 views

WP_Query - How to get all posts of specific days of week by custom field date?

I have a filter on frontend with days of weeks, and I need show only posts that are published on especific day (or days). The date are on custom field day_of_event (the filter is based on this field, ...
rafaelfndev's user avatar
2 votes
2 answers
662 views

Hook for inserting?

I'm using a plugin that doesn't provide many hooks for its actions. I would like to be able to hook in when the plugin adds a row to a plugin-specific table, and update some other data elsewhere. (For ...
WebElaine's user avatar
  • 9,430
0 votes
0 answers
700 views

Elementor posts custom query based on tag [closed]

How can I filter the Elementor Posts widget with a custom php query that returns posts with a specific tag attached? I want to do something similar to this: function my_query_by_post_types( $query ) { ...
ChristosDg's user avatar
0 votes
2 answers
218 views

Is it possible to add the_content filter upon login?

I've added a wp_login action and it's getting executed. Then within that function, I'm adding a filter to the_content so that a script gets inserted upon certain conditions but it's not getting ...
Vic's user avatar
  • 1
0 votes
1 answer
27 views

Restrict editing of post type to list stored in user meta

What is the right action to invoke before a custom post type is getting edited in dashboard and contains the argument the post id? The url /wp-admin/post.php?post=282&action=edit&classic-...
fefe's user avatar
  • 874
0 votes
1 answer
88 views

Add new users to "add new user" page on admin's dashboard

I understand there's a lot of similar questions, but all of them show how to update the wp_usermeta table in the database, whereas I want to use wp_update_user() to update a particular field (nickname ...
Assunivasf's user avatar
0 votes
2 answers
939 views

How to stop execution of a function via add_action hook?

I have the following functions: function test($post_id){ do_action('test_action',$post_id); echo $post_id; } add_action('test_action',function($post_id){ if ( $post_id == 2 ) //Stop test function ...
dc09's user avatar
  • 195
1 vote
0 answers
264 views

add_action and do_action: multiple calls to same callback?

I have a setup similar to this: function get_type_data($val) { // Get the data from the DB where the ID is $val and return it. } add_action('my_hook', array($this, 'get_type_data'), 10, 1); I ...
Kobus Myburgh's user avatar
0 votes
1 answer
203 views

Ajax callback not work

My files is : synergyservice.php register_activation_hook( __FILE__, array( 'Synergy', 'plugin_activation' ) ); register_deactivation_hook( __FILE__, array( 'Synergy', 'plugin_deactivation' ) ); if ( ...
tecnico57's user avatar

1
2 3 4 5
29