All Questions
205 questions
1
vote
1
answer
22
views
How to customize WP_Error (REST JWT authentication plugin) [closed]
🔖 Background & Environment
WordPress
6.6.2
JWT Authentication plugin
1.3.4
Php
8.3
I'm using the recommended plugin JWT authentication for WP REST API, to authenticate my users.
Asking /wp-...
1
vote
1
answer
3k
views
WordPress user account activation
How do I implement user account activation in WordPress? (This is not for multisite.)
Once the user registers through the site or admin panel, the user should get an email with an activation link.
...
0
votes
1
answer
2k
views
AJAX login without a plugin does not work. when add a action to function.php
I am using wordpress ajax login without a plugin.
I want to not be allowed users access to the WordPress profile after login, Because i have designed a specific profile in the link: http://www....
0
votes
1
answer
4k
views
Action hook "wp_insert_post" works but not for last imported post
I want to run a custom function whenever posts are imported to my custom post type.
I am currently running this code -
function on_post_import($post){
global $wpdb;
$results = $wpdb->...
4
votes
1
answer
2k
views
Add custom buttons with custom actions in Edit Post screen in WordPress?
I am creating something for a client and I have a Class that I created with a Custom Post Type called 'PuSH Feeds' and when the user adds a new post and publishes it they can then click on one of two ...
0
votes
1
answer
27
views
Remove 3rd party plugin notices from within own plugin
I'm trying to build a plugin (complete novice) and on the landing page of my plugin I don't get the 3rd party plugin notices / banners but with all of my sub pages I do. How can I completely remove ...
1
vote
2
answers
2k
views
Detect when any plugin is activated or deactivated
I have a starter theme I use for most websites I built myself. Because each site has different plugin dependencies, I'm trying to create a script that essentially collates a list of all plugins ...
6
votes
1
answer
1k
views
Wordpress admin notice in plugin function
i have sample wordpress plugin class. Im hooking woocommerce woocommerce_saved_order_items and i want create a admin notice. Add action from __construct works, but when i want create a notice in hook ...
0
votes
1
answer
2k
views
Advanced WordPress plugin activation detection
I'm testing the plugin activation detection because something went wrong in my plugin. I discovered the problem, but didn't understand it:
I'm trying to check for plugins activation (others and my ...
44
votes
2
answers
56k
views
Get a list of all registered actions
I'm trying to debug a plugin which I didn't develop and I want to list all the registered actions. I've read this SO thread:
WordPress: How do I get all the registered functions for 'the_content' ...
0
votes
0
answers
40
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. ...
0
votes
1
answer
56
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 {
...
0
votes
1
answer
41
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 ...
1
vote
1
answer
117
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 ...
0
votes
1
answer
59
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.
0
votes
1
answer
78
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( '...
0
votes
1
answer
2k
views
Hooking into the HTML header container
I'm trying to hook into the header.php of wordpress theme(s) more specifically, right before the closing header tag </header>. I'd like to do this in a programmatic way so when I switch themes I ...
24
votes
2
answers
26k
views
How can I see all the actions attached to an "add_action" hook?
I'm working with the admin bar and trying to debug some of the menus and their priorities.
I know several callbacks get bound to actions, such as this one:
add_action( 'admin_bar_menu', '...
0
votes
1
answer
3k
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
1
answer
47
views
What is @Action in Wordpress?
I have found this code snippet on a plugin.
/** * @Action(name="workforce_content_loop_before", priority=10) */
public static function show_breadcrumb() {
echo do_shortcode( '[...
0
votes
0
answers
23
views
How do I add an action using namespaces, and file separation? [duplicate]
I'm working on a plugin, and I'm trying to get to grips with namespaces and how they work with actions. In a separate file, I have a single function with a namespace declared at the top:
namespace ...
0
votes
3
answers
1k
views
wp_ajax action responds with 0
I'm writing a plugin.
There is a button, that triggers an ajax-request to an action I added in my plugin page:
Head of my plugin PHP file:
add_action('wp_ajax_update_nav_items', 'update_nav_items' )...
0
votes
1
answer
1k
views
Add action to custom Function
I am trying to use plugin action in my custom function. Plugin is adding an action to wordpress registration form
add_action( 'bp_before_account_details_fields', 'tv_bp_avatar_upload_form' );
But i ...
0
votes
1
answer
378
views
update_option_{$option} not working (do function after options are saved)
Below is my code for a simple plugin settings page. It works and saves an option ("EN", "CZ").
However, what I intend to do is run a function after the options get saved (see at ...
0
votes
1
answer
433
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. ...
64
votes
12
answers
56k
views
Passing a parameter to filter and action functions
Is a way to pass my own parameters to the function in add_filter or add_action.
For example take a look in the following code:
function my_content($content, $my_param)
{
do something...
using $...
0
votes
1
answer
2k
views
How to remove products-links after the product title using remove_action
I'm trying to remove the navigation between products that appears right after the product title in my products pages.
The navigation is set in the woocommerce.php file of my theme:
/**
* Class for ...
0
votes
1
answer
1k
views
Types plugin custom post add_action hooks
I'm using the wp-types plugin to create a custom post type. I'm developing my own plugin which I need to fire whenever a post of my custom post type is updated.
Right now add_action( 'save_post', '...
0
votes
1
answer
18
views
Why do actions with class and public method don't fire __construct()
I'm trying to understand how WordPress works with actions, classes, and methods.
If there is a class "TestClass" and it has a public method 'method1'
The method can be hooked to any action ...
0
votes
1
answer
131
views
The function called on the wp head hook becomes null
Sample code:
function test_loaded() {
require_once 'file.php';
$ins = Sample_Class::instance();
require_once 'file2.php';
}
add_action('plugins_loaded', 'test_loaded');
in file.php
class ...
0
votes
0
answers
54
views
i create functions.php in plugin files but add_action ('wp_head', 'function_name') don't work
ı use add_action hook in my plugin but not working hook
add_action('wp_head', 'cerezcss');
function cerezcss(){
?>
<!--cerezcssbaslangic-->
<link rel="...
0
votes
1
answer
55
views
Sharing varible between two add_actions
I'd like to share a variable between two add_actions. Currently I'm trying to use a global. However it doesn't work. This simple example below illustrates the problem. In this example, ...
2
votes
1
answer
405
views
How to prevent action in ajax request, when in admin side?
I have a plugin that hides certain posts in the frontend. For this to be consistent, I need posts to also be hidden in searches and AJAX searches (needs to work with any theme and search).
To make ...
2
votes
2
answers
6k
views
How to register custom post types in a plugin?
I'm using toscho's Plugin Class Demo code as a foundation for a plugin I'm developing. Amongst other things, my plugin registers a custom post type.
public function plugin_setup() {
$this->...
1
vote
2
answers
2k
views
Calling plugin function inside custom plugin for onclick event
I want testFunction() to call check() that i created in my plugin php when i click My Button. How do i make it work ?
<?php
function createButton()
{
echo '<button onclick="testFunction()"&...
0
votes
0
answers
116
views
Discern a specific plugin's action hooks
I'm new to Wordpress plugin development (but not to coding) so please excuse the question.
I am trying to develop a plugin to catch user registrations and populate other web application databases ...
1
vote
1
answer
662
views
Inject HTML meta tag inside wordpress <head> tag using add_shortcode
I am trying to add some meta-tag when shortcode [refresh url='http://stackoverflow.com'] tag is used.
I have done below code, but it is not working, I want to inject HTML code between "<head>" ...
0
votes
1
answer
2k
views
How to get menu location in wp_update_nav_menu hook
I want to get the menu location in the wp_update_nav_menu (during menu save action)
add_action('wp_update_nav_menu', function ($id, $data = NULL)
{
error_log( var_export($data, true) );
...
0
votes
2
answers
2k
views
wp_login_form() ignoring login_form action hook
I have created a custom login page that uses wp_login_form() to create the login form:
<div class="login-form">
<?php
wp_login_form( array(
'remember' => false,
'...
1
vote
1
answer
217
views
How to check current user before all actions and filters?
I am working on a plugin with 50+ actions and filters. All actions and filters only apply to users with a specific user meta (b2b). I want to check this user meta before everything How can I do this? ...
0
votes
3
answers
4k
views
How to get post ID with hooks publish_post, new_to_publish, etc
I have two plugins, one uses the function wp_insert_post(), the other has a code like this:
add_action('future_to_publish', 'myFunc', 10, 1);
add_action('new_to_publish', 'myFunc', 10, 1);
add_action(...
0
votes
4
answers
8k
views
register_activation_hook in oop approach
I tried to develop a plugin in OOP approach.
I tried to load all the function needed inside the constructor class e.g action hooks. The problem is this hook "register_activation_hook". It wont load ...
0
votes
0
answers
150
views
How to remove default action from a plugin?
I'm trying to remove the default wordpress action:
add_action( 'do_pings', 'do_all_pings', 10, 1 );
from wp-includes/default-filters.php
This is the code I have (plugin):
add_action( 'init', '...
0
votes
1
answer
359
views
New bulk action to resend welcome emails
I have added a new custom bulk action to the user listing page called Resend Welcome Email, it is showing and running.
What I'm looking to do is fire the Resend Welcome Email plugin's action. I'm ...
0
votes
0
answers
45
views
Removing Plugin Action via Theme for Non-admins
add_action( 'plugins_loaded', 'mytheme_remove_show_my_balance' );
function mytheme_remove_show_my_balance() {
if ( !current_user_can( 'administrator' ) ) {
remove_action( 'personal_options', ...
1
vote
2
answers
29k
views
How to remove action from plugin?
I have a plugin that adds the following action which among other things sends out a registration mail when a new user is added:
add_action('um_post_registration_approved_hook', '...
0
votes
1
answer
151
views
How to Unhook actions/filters in within Class in plugin
I have a business website for vacation home rentals in which the WordPress theme has its own booking system for house bookings only and it has been great!
I also, have Tour/Services (not Houses) also ...
0
votes
1
answer
2k
views
a weird attribute on every html tag
me and my friend working on a Wordpress site but we see it differently on our machines,
He sees a weird attribute wfd-id="" on every html tag in google console when he inspect it,
also I loaded ...
0
votes
0
answers
489
views
WPML - Hook when language is switched (change user language)
I would like to change the logged in user's language (if someone is logged in) when they change the language in front-end.
I'm using the WPML Multilingual CMS plugin in my Wordpress website.
I've ...
0
votes
0
answers
871
views
Nested Actions and Filters
It is possible and a good practice to combine filters and actions, it is necessary to take into account the order in which they are executed, a graphic example https://images.app.goo.gl/...