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
1 answer
932 views

How do I add something to the "Edit Tag" page in wp-admin?

I have some term_meta that I would like to display on the "Edit Tag" page in wp-admin. I found the following two action hooks, but both don't do what I want. edit_tag_form edit_tag_form_pre These ...
Swen's user avatar
  • 1,374
0 votes
1 answer
975 views

Filter for when the post is updated

Is there a way to check in admin page if a post was just updated? It looks like WP shows a notification so there must be a hook but I can't find it.. I want to trigger some js in the post.php in the ...
CyberJ's user avatar
  • 437
1 vote
1 answer
216 views

Enque script based on url paramater

I'm using the following to enqueue a script in admin. function add_admin_scripts( $hook ) { global $post; if ( $hook == 'post-new.php' || $hook == 'post.php' ) { if ( 'custom' === $...
CyberJ's user avatar
  • 437
1 vote
1 answer
453 views

Filter taxonomy admin pagination

In the taxonomy admin area, I'm filtering out some taxonomy terms based on meta keys associated to users. The pagination still think there's the full number of terms. Does a hook exist that would ...
JacobTheDev's user avatar
  • 1,221
0 votes
1 answer
103 views

Remove tags without a specific meta key from "choose from the most used tags"

I'm trying to only show the tags that are associated to the currently logged in author; I've got this 99% working, but the author can still choose tags associated to other users via the "Choose from ...
JacobTheDev's user avatar
  • 1,221
0 votes
1 answer
159 views

Remove genesis_404 hook from genesis_loop [closed]

I am using the genesis theme and I want to make a custom 404 page. For that, I wish to remove the default 404 hook and implement my own. In my plugins functions.php I added my action: add_action( '...
Maarten Wolfsen's user avatar
1 vote
1 answer
3k views

How to remove a custom action on child theme?

On parent theme index.php i have this code: // The function. add_action( 'mytheme_example_action', 'mytheme_example_function' ); function mytheme_example_function() { echo 'Example text on index ...
Jozefini's user avatar
  • 166
-1 votes
1 answer
136 views

Insert plugin html content to a specific spot in the frontpage

I'm trying to insert plugin html content to a specific spot in the frontpage of a site. The site uses the Divi theme. I'm trying to avoid putting any code in the original Wordpress or Divi theme ...
Livi17's user avatar
  • 107
0 votes
1 answer
133 views

call custom action after delete account

I want to call custom action, after a user is deleting his account. I'm using the premium theme wplms which is using buddypress for this stuff. After the submit button in the delete-account.php there ...
murcoder's user avatar
0 votes
1 answer
565 views

why does not work ajax that add_action registered in wordpress

I create a template page in WordPress and use add_action to define action that use in Ajax. <?php /*template name: get_pass */ add_filter('wp_ajax_my_action1','mda_get_license'); function ...
MDA's user avatar
  • 1
1 vote
0 answers
70 views

Plugin developer automated documentation

I have published a plugin which provides a nice extensibility. Now, I want to provide my users an automated PHP Documentation which describes the API Functions, Filters and Actions like this page here:...
Matthias Günter's user avatar
1 vote
2 answers
130 views

Action when sidebars updated

Is there any action that triggers after the sidebars have been updated? For example, for menus, I use wp_update_nav_menu, but I didn't find any way to do something alike with sidebars.
Mateus Felipe's user avatar
1 vote
1 answer
237 views

How to remove function?

I'm trying to remove a function that is defined in my parent theme but can't get it to work. The function I want to remove prints previous/next post navigation. Here's the function: add_action( '...
jrcollins's user avatar
  • 571
7 votes
3 answers
9k views

Remove Editor From Homepage

Im trying to remove the editor from the homepage using the following functions however I am struggling to achieve this? function hide_homepage_editor() { if ( is_admin() ) { if (...
lky's user avatar
  • 281
0 votes
1 answer
251 views

Find out if post was just updated on post edit screen

Is it possible to add an admin_notice to the post.php edit screen in the admin– only if the post was just updated. function my_admin_notice(){ global $pagenow; if ( $pagenow == 'post.php' ) { ...
rob-gordon's user avatar
0 votes
1 answer
199 views

How can i take all ids from untrash_post action?

When the user chooses to restore a post ( from "Trash" folder ) with the following way, through the action untrash_post, i get the id of the posts. function my_untrash_post_type( $post_id ) { ...
Shake-the-World's user avatar
1 vote
1 answer
963 views

How do I pass arguments for multiple functions hooked to a single action?

I wanted to set a default value for a parameter: function my_function( $arg = 'foo' ) { echo $arg } add_action('my_action', 'my_function'); function my_2nd_function( $arg = 'bar' ) { echo $...
David Guilartes's user avatar
0 votes
1 answer
275 views

Remove meta box except on category pages

To disable custom fields except on category pages, how would I check if it's a category page? Maybe it would be like this: add_action( 'admin_menu', 'remove_custom_fields' ); function ...
Galivan's user avatar
  • 243
0 votes
1 answer
137 views

Add/remove CRON action depending on variable

I've hooked a function on to a CRON job called 'job_manager_check_for_expired_jobs', and I want it to run based on the value of a variable $create_sitemap. The value is true by default, but can be ...
stevenkellow's user avatar
1 vote
2 answers
5k views

How to run a function when post is edited or updated using publish post action?

I want to run a function A() when a post is published and function B() when the same post is edited or updated. For this, I found publish_post action which is triggered whenever a post is published, ...
busyjax's user avatar
  • 539
0 votes
1 answer
3k views

Add html code in admin page

I'm trying to add floating button in admin page. If I using add_action('admin_footer', 'my_admin_function'); The button will in the bottom of the page and I need to scroll down. I need the ...
kyrie's user avatar
  • 37
0 votes
1 answer
2k views

Put data in my-account/view-order/id/ page

Is ther a filter or an action to put information after order status information just before "Order Details" title? I found 'woocommerce_view_order' action, but it puts all at the bottom of the page.
Salvio's user avatar
  • 85
0 votes
1 answer
590 views

Keep br tags from stripping

Is there some filter to disable this, sometimes awful feature? I need content of some custom post type to be displayed intact, with all of <br>s. To get the content I'm using get_the_content()...
Miloš Đakonović's user avatar
1 vote
2 answers
382 views

Extend a class of a plugin

There is a plugin that uses a class; and create an object like this: class WC_Disability_VAT_Exemption { public function __construct() { add_action( 'woocommerce_after_order_notes', ...
Nick P.'s user avatar
  • 111
0 votes
1 answer
444 views

Form action unfamiliar

I am refactoring some code in the header.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://...
Daniel's user avatar
  • 351
1 vote
1 answer
366 views

How to access $post from a callback function

I am wondering whether using global $post is a 'best practice' when it is necessary to get the $post within a callback function triggered by an action hook. The code would be: class myPlugin { ...
Pisuke Soramame's user avatar
0 votes
0 answers
81 views

What action/hook do I need to register to have my plugin handle front-end editing?

What action/hook do I need to register to have my plugin handle front-end editing? For example; with the plugin Elementor if a user clicks the below blue button they get taken to the url http://...
sazr's user avatar
  • 357
0 votes
0 answers
55 views

Hooks with same priority number. Can one stack items returned in divs, position: absolute each with their own z-index?

Is there is a way to call a single hook via do_action, attaching four different functions with the same priority number (wrapped in divs) calling items (get_title get_thumbnail etc) and set position:...
acctindie's user avatar
1 vote
1 answer
1k views

Which action hook to update custom field at network/site-info.php in multisite on update site info

I am currently using code to add a custom field to the site-info.php & site-new.php in the network admin management to add a custom option to the database, this does work when I create a new ...
K. Tromp's user avatar
  • 213
0 votes
2 answers
3k views

Functions.php change for Woocommerce not working

I am trying to add this to functions.php. In my test lab on a different site it adds the test info information fine. But on the website I am trying to add it to nothing happens. The website is running ...
WebberMD's user avatar
0 votes
1 answer
2k views

How to pass variables to a function argument using add_action [duplicate]

I have a test.php plugin file inside my plugin/ folder and I am trying to send an email from this plugin. I have a code that looks like this currently in my plugin. add_action('init', '...
meskerem's user avatar
  • 101
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 ...
Aerendir's user avatar
  • 288
0 votes
1 answer
317 views

Get Taxonomy name from “registered_taxonomy” hook

I am using add_action to run a function after a taxonomy is created. Everything works but I can’t figure out how to grab the taxonomy name. I figured $args->name would be the way to go but it is not ...
Jaxy's user avatar
  • 1
0 votes
0 answers
73 views

Grab meta data before post is saved

I'm trying to grab the metadata for a post before it is saved. I know that I could use the 'post_updated' hook (https://developer.wordpress.org/reference/hooks/post_updated/) to grab the before/after ...
Yazmin's user avatar
  • 327
0 votes
1 answer
1k views

AMP - Change rel="canonical" from functions.php [closed]

the source action in /amp/includes/amp-post-template-actions.php is: add_action( 'amp_post_template_head', 'amp_post_template_add_canonical' ); function amp_post_template_add_canonical( $...
Jlil's user avatar
  • 222
1 vote
1 answer
1k views

What's the difference between hooks, filters and actions? [duplicate]

It seems like the terms hooks, filters and actions are used interchangeably. What's the difference between them? What do they do? How do I use them?
cjbj's user avatar
  • 14.5k
0 votes
2 answers
6k views

Add a filter inside an action init

Hello in the init action, I would like to add a filter to a fairly large function to modify variables in the $vars array, for example the Wordpress post ID. That is to say: add_action( 'init',...
jcarlosweb's user avatar
1 vote
1 answer
604 views

Remove an action hook within a Class

I've got the following class declaration: class stachethemes_ec_main extends stachethemes\event_calendar\stachethemes_main_template { and the following function with the action hooks: public ...
deyan4's user avatar
  • 11
0 votes
0 answers
267 views

Wordpress hooks to call a function inside a construct

I am trying to call a custom function inside the constructor function. Which action hook to be used? class myClass{ public function __construct(){ add_action('$hook', array($this, ...
jeff's user avatar
  • 109
5 votes
2 answers
8k views

trigger save_post event programmatically

Is there a way to trigger the post saving or updating event in code? such as do_action('save_post', $post_id); The function here seems to imply that a WP_POST object needs to be passed in. Is there a ...
TurtleTread's user avatar
0 votes
1 answer
306 views

Is this the correct way to enqueue style sheets from parent theme and then from child theme in wordpress?

I am creating a child theme of a theme in WordPress. In Parent theme i have style.css and inside css folder of parent theme i have a base.css file ( and some more css files but the problem is only ...
Desperado's user avatar
0 votes
1 answer
477 views

Can I run a slow action in a seperate thread?

I have a really slow-running action (30-45 seconds) that loops over each user in my DB and syncs the data with some off-site database. I want this to happen once or twice daily, so I have a WP-Cron ...
Ahrengot's user avatar
  • 442
0 votes
1 answer
59 views

wordpress is_front_page() issue

I am updating the page title of all pages with a function i have created: function wpss_show_custom_description() { $wpss_disable = get_post_meta(get_the_id(), 'wpss_disable', true); $...
danyo's user avatar
  • 355
0 votes
2 answers
2k views

How dynamic action login_form_{action} is working

I found this action hook in wp-login.php file. It says it can be used to create custom actions to the wp-login. However, as I'm new to WP coding and PHP, I do not understand how {action} can work even ...
Himanshu's user avatar
2 votes
1 answer
2k views

Action on post publish

I want to do something when a post is published (doesn't matter if updated [draft -> publish] or just created) In my plugin I tried different actions to try this. I tried the following code to detect ...
TheBalco's user avatar
  • 183
1 vote
1 answer
176 views

Wordpress filter that hook after each action/filter hook

In my wordpress site virus script added in footer on wp_footer action. I try many techniques, but i cant find virus hook location. Is there any wp action/filter, that hook after each action /filter ...
asad app's user avatar
  • 111
3 votes
2 answers
890 views

How to access certain WP functions inside custom class, in theme folder

I'm building a custom theme and I want to create a helper class for handling creation of metaboxes in admin panel. I have my class declared like this: namespace ci\wp; Metaboxes::init(); class ...
NoviQ's user avatar
  • 57
7 votes
1 answer
6k views

How do you use the plugin boilerplate loader class to hook actions and filters?

The Plugin_Name_Loader class of the WordPress Plugin Boilerplate is very useful if you must hook into a WordPress action or filter from your plugin. The original author, Tom McFarlin, says the ...
iyrin's user avatar
  • 1,796
0 votes
1 answer
101 views

How to find list of all functions bind to a particular hook from my plugin?

I want to remove all actions attached to admin_notice hook in my plugin at the time a user updates the plugin. Is there any way to find the list of functions attached to admin_notice hook by my plugin?...
learning_13's user avatar
1 vote
1 answer
27 views

Tried in different ways but sidebar not working?

function Y_widget_register(){ register_sidebar(array( 'name'=>esc_html__( 'Sidebar', 'Y-07' ), 'id'=> 'y-sidebar', 'description'=>'Dynamic Right Sidebar', 'before_widget' =...
Y07's user avatar
  • 79

1
9 10
11
12 13
29