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-...
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 ...
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 ...
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( '...
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
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
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. ...
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 ...
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 ...
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>" ...
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
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', ...
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
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/...
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
402
views
Passing function into add_action always returns the first argument
I'm building a plugin that iterates across and parses the arguments of various WordPress hooks, and because of the flexibility needed I'm passing a function as the callable parameter in add_action:
...
0
votes
1
answer
391
views
WooCommerce: after install hook
There is some hook that is triggered after WooCommerce Install (I mean the WooCommerce Wizard, not the plugin installation)? I didn't found a hook to do this and the Wizard Class (...
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 ...
1
vote
1
answer
342
views
How to Use Parameters with a Do_Action Function Within PHP Tags
I'm using a WordPress plugin that allows integration actions to integrate it within a theme. Using GeneratePress' Elements feature, I'm adding the action as a hook. Currently the code I'm using is:
&...
0
votes
1
answer
525
views
Get post content inside plugin class method
I'm writing a simple SEO class that will add the various metatag to the header of wordpress.
I've two little problems with the wordpress api.
The first is that I need to remove the last comma from ...
1
vote
1
answer
45
views
CampaignMonitor for WooCommerce - Move subscribe button [closed]
So I need to move the checkbox provided by CampaignMonitor for WooCommerce to a different part of the checkout screen. I've already managed to copy it to the right place via
add_action( '...
1
vote
3
answers
126
views
How do action and filter hooks understand where to look for the core function that we hooked our function to them
I want to know how does WordPress core files handle the relationship between module and core of the WordPress? We all know it uses add_action() and add_filter() to manipulate data according to our ...
0
votes
3
answers
7k
views
Ajax call to php function doesn't work PHP code
I have a form like this:
<form method="post" action="" id="BookingForm">
<label for="email">Email</label>
<input type="text" name="email" id="emailId" value="" />
&...
0
votes
0
answers
72
views
Remove action added in plugin class from theme
I am trying to remove action that is added via plugin in my theme. The below plugin class creates a portfolio page template but I don't want this page template in my theme. Is there any way to unhook ...
0
votes
1
answer
102
views
{status}_{post_type} does not run correctly?
I used the hook {status}_{post_type} from the docs here.
In the docs it said: action will execute when a post of type {post_type} transitions to {status} from any other status.
Here is my code:
...
1
vote
0
answers
277
views
Get Time Taken By Each Action Hook in Wordpress
I am developing a Plugin, and want to record Time taken by each Action Hook, I am able to get all the Hooks Triggered on a Page with the Action and Priority, but i am unable to get the Time taken by ...
0
votes
2
answers
828
views
get gravity form ID from backend/wordpress admin
I want to add a filter to a form submission
like it is done here.
add_action('gform_pre_submission_6', 'capitalize_fields_6');
function capitalize_fields_6($form){
// Code here
}
My question is, ...
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 ...
0
votes
1
answer
227
views
How to remove a class function from a plugin by using remove_action()?
Result of the var_dump('parse_query'):
WP_Hook::__set_state(array(
'callbacks' =>
array (
10 =>
array (
'...
0
votes
0
answers
1k
views
Change hook to add_action in a plugin class
<?php
namespace wp_gdpr_wc\controller;
use wp_gdpr\lib\Gdpr_Container;
use wp_gdpr_wc\lib\Gdpr_Wc_Translation;
use wp_gdpr_wc\model\Wc_Model;
class Controller_Wc {
const REQUEST_TYPE = 3;
...
1
vote
0
answers
35
views
Are functions in main plugin file called before function bound to register_activation_hook runs?
In my plugin, I am doing a minimum-supported PHP version compatibility check via a function bound to register_activation_hook and halting activation for those on PHP version less than the minimum ...
2
votes
1
answer
2k
views
'wp_login' action hook not working with wp-login.php file
Wordpress 4.9.5
I am work on demo to check after login call some action or function, so that i prepare one plugin. Here is the code.
<?php
/*
Plugin Name: Test Login
Plugin URI: http://wordpress....
0
votes
1
answer
492
views
Problem with removing plugin action
in my functions.php I try to remove an action from a plugin class. See both codes below. the remove doesn't work, but when I comment out the add_action (line 39) in the plugin class, then it works. ...
0
votes
0
answers
730
views
Frontend AJAX Request causes Error: 'Call to undefined function add_action'
I wrote a little plugin that is supposed to handle a form submission and send some mails. When the form is submitted the request fails.
Im on a local MAMP Environment and my PHP error log shows me ...
0
votes
1
answer
1k
views
edit_user_profile and show_user_profile are not firing inside a class
I have a clean installation of Wordpress, without any extra plugins installed (only for testing purpose).
I have created a test-plugin and declared the following class:
<?php
defined( 'ABSPATH' ) ...
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 ...