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

learn more… | top users | synonyms (2)

0
votes
0answers
13 views

after_switch_theme not working in a class?

Here is my class (by way of example) after_switch_theme is being stupid and refuses to fire. class myPlugin(){ __construct(){ add_action('after_switch_theme', array($this, 'rewrite')); ...
4
votes
1answer
65 views

Getting instance variable in scope of 'wp_enqueue_scripts'

I need a little help getting my head around passing instance variable to a hook. I am reading the CSS files I need in my template dynamically and storing them in a $settings object that I am keeping ...
0
votes
0answers
10 views

add_action to stop processing further on error notice

I am trying to stop a woocommerce do_action( 'lostpassword_post' ). On another function I am adding the above action and checking on default values it should not send email and infact want the ...
0
votes
0answers
13 views

call_user_func_array error only when another plugin is active

So I wrote a plugin that uses the following function to make the backend: add_action( 'admin_menu', 'create_backend_menu' ); if(!function_exists("create_backend_menu")) { function ...
0
votes
0answers
20 views

How to get all the predefined do_action() calls from an active theme

To hook my plugin content into anywhere, suppose I offered the theme developers to create their own hooks with a prefix (pre_) anywhere in their theme - the rest of the hook is unknown to me. So what ...
1
vote
1answer
60 views
+100

WP cron doesn't pass through my arguments

I've been trying to import some posts trough a cron action. The problem is my last step. Everything is going well, except for the execution of the cron. It is only passing trough the first argument. ...
0
votes
3answers
29 views

Action on WordPress Install

I am trying to use this https://gist.github.com/davejamesmiller/1966425 to fire when I first create WordPress site / "install WordPress" (i.e complete the "5 minute setup") but the wpmu_new_blog ...
0
votes
0answers
44 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: ...
0
votes
0answers
20 views

admin_post hook error message passing

I've mocked up a quick skeleton plugin, I'm trying to catch the $_POST data from the form template. The best route that I've found is using the hook admin_post, unless there is a better alternative? ...
0
votes
0answers
18 views

do_action inside of onclick

I'm brand new with making plugins/widgets, and am probably pretty limited to basic in knowledge with php as well. I want to be able to register a function that runs when a button is clicked. The ...
0
votes
2answers
22 views

How do I override the user's input when updating a custom post type's permalink?

When publishing a custom post type, I'm trying to override the custom permalink based on code rather than what the user types into the input box. I can confirm my action is firing correctly, but I'm ...
0
votes
0answers
8 views

Running wp_schedule_single_event on Post Import

I'm trying to have a category deleted after a certain length of time once a post has been published. I was successful in doing this when a post is manually created, but I cannot for the life of me ...
0
votes
0answers
18 views

Getting current user option within a function

I have created a new true/false field for specific user role "Member" to receive email notifications if a new post is published. For reference I'm using advanced custom fields to create a true/false ...
0
votes
1answer
26 views

remove_action not removing add_action from constructor

I am trying to replace a message from a function that got hooked in a constructor from a class from woocommerce. This is what I tried to remove the message: What I tried. function remove_actions() ...
0
votes
1answer
32 views

Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()

I'm developing a plugin and I've problem with inserting new term to my custom taxonomy. <?php add_action('init', 'create_tax', 0); function create_tax() { $args = array(...); ...
0
votes
1answer
36 views

Remove_action from plugin with a Class

I've searched around but haven't been able to find a solution to this. I'm trying to hook in and remove an action that was initiated by a plugin (specifically the Groups plugin). The function itself ...
0
votes
0answers
11 views

Add_action does not work

I am trying to make a coming soon page with a small form for subscribers who want to be informed about future developments. Therefore, I want to make a subscribe.php file, located in the root ...
0
votes
1answer
49 views

WordPress Plugin Boilerplate - add_action hook in static “activate” function

I'm hoping someone can point me in the right direction here. I'm using the Wordpress Plugin Boilerplate to develop a custom plugin. On install, the plugin will register a new post type (course), a ...
0
votes
1answer
26 views

Set default Custom Post Meta Value

I've tried almost anything and just can't get this to work. I have a custom post type with a custom meta field and I want a default value to be added on when the Publish/Update/Save button is ...
0
votes
0answers
24 views

Wordpress action form url doesn't work

I have a page-contact.php (i have my custom form) <form id="contact-form" name="contact-form" method="post" action=""> <input type="text" name="name" ...
1
vote
0answers
42 views

action hooks returning old category instead of new category

With some help I created a WP Action to send an email to the author of a post (custom post type) when the category has been changed. This works ok, except that the function is returning the previous ...
1
vote
2answers
23 views

how to change appearence of the content of default post list columns?

Speaking about backoffice here. I usually add columns and filters to the backoffice for certain custom post types. No problem here. BUt what if I would simply like to change something on the content ...
1
vote
1answer
43 views

An echo line in a transition_post_status action leads to “cannot modify header information - headers already sent by”

I tried to set up an action hook with transition_post_status. Inside I wanted to set up a few conditional statements. To see if everything works I wanted to place a debug statement. Problem is as soon ...
0
votes
1answer
135 views

Admin: global $post empty

I tried to get $post var outside function php in wordpress admin panel. The only way that I find to access to $post is to add_action. However I want to get this var outside the add_action and global ...
2
votes
1answer
54 views

Send an email when custom post type category is changed

This is the first time I've attempted to write an action hook. My CPT has 4 categories. I'm trying to make WP automatically sends an email notification when the category is changed. By change I ...
0
votes
1answer
17 views

Using category slug in add_rewrite rule

I'm using this function ro rewrite URLs: function archive_rewrite_rules(){ add_rewrite_rule( 'inspiracao/([^/]*)/([0-9]{4})/?$', ...
0
votes
0answers
25 views

Action wp_footer with priority 1 is after wp_print_footer_scripts

In my Wordpress 4.1 instance I found a strange thing. The wp_footer action print_script with priority 1 is executed after wp_print_footer_scripts which has priority 20. add_action( 'wp_footer', ...
0
votes
0answers
31 views

Object oriented programming, add_action in constructor not firing

I am trying to write a class that adds an action to the save_post hook, but the post_updated function never gets called. I tried some variations, but it never gets called. Am I doing something wrong? ...
0
votes
1answer
253 views

Fatal error: Call to undefined function add_action() - an untouched problem

The question was asked many times in many ways, but unfortunately is not covered well in most of the answers. I'm having the same issue doing things using include-files. In my TwentyFourteen child ...
0
votes
1answer
15 views

add hook restricted only to either plugins or themes?

I'm writing a plugin and I want to create two hooks like the following: add_action( 'myplugin/ready_for_theme', array( __CLASS__, 'myfunction_for_themes' ) ); add_action( ...
0
votes
0answers
21 views

add_action - $function_to_add first argument defaults overwritten

I have an issue with the following code, $function_to_add first argument defaults are overwritten with an empty string "" and it cause an error: Warning: join(): Invalid arguments passed The second ...
0
votes
1answer
84 views

Should I use add_action('publish_post or add_filter('publish_post?

I am trying to trigger an extra function as soon as a certain custom post type is published function insert_table_products($post_id, $post) { if ($post->post_type == 'custom-products') { ...
0
votes
0answers
25 views

Remove action added from class

This has been asked before and I know how to do this but im having trouble removing a specific action added by the easy columns plugin. The action is added similar to below: class EasyColumns { ...
0
votes
1answer
34 views

WordPress HTML Helper

I've played recently with WordPress Hooks and I've noticed that in order to create layouts based on the hooks the main practice is to use html in functions and combine them with logic. I've searched ...
1
vote
1answer
44 views

Problem:Save Several Duplicate posts in The Database and then Error nesting level of '100' reached

I have a function to insert a single post in the database. But when I run the function, duplicate posts (40) are added to the database and then an error is displayed. Fatal error: Maximum ...
0
votes
1answer
53 views

add_action in the loop hooks

I have the following structure: add_action('my_content', 'standard_loop'); function standard_loop() { if (have_posts()) : while (have_posts()) : the_post(); ...
0
votes
0answers
20 views

Problem with wp_login_form()

I'm using wp_login_form(); to display the login form in the front-end. And added after that do_action('login_form'); which should display capacha verification from a plugin. The problem is that the ...
0
votes
1answer
47 views

Remove action working on functions.php but not in a plugin. Why?

I am trying to remove an action from Woothemes' Sensei plugin. If I do on the functions.php: global $woothemes_sensei; remove_action('sensei_lesson_video', array($woothemes_sensei->frontend, ...
5
votes
1answer
37 views

Does the event 'wp_version_check' even exist? What is it doing?

In version 4.1 of /wp-includes/update.php around line 674, there's this line: add_action('wp_version_check', 'wp_version_check'); I searched through all the wordpress core files for a ...
0
votes
1answer
26 views

Which action gets triggered when i save settings?

I want to write to a file but i need to write/update this file every time user updates settings.Is there any action that gets fired every time user updates settings ? Edit: I have a new menu page and ...
0
votes
1answer
41 views

How to create shortcode for auto login after registration

I've a code for auto-login after registration which is: function auto_login_new_user( $user_id ) { wp_set_current_user($user_id); wp_set_auth_cookie($user_id); $request = ...
0
votes
0answers
14 views

Get variable value outside action hook [duplicate]

I'm trying to get current screen within wp-admin for some conditional functions to run based on screeen name as follow : global $this_screen; function wporg_current_screen_example( $current_screen ) ...
0
votes
0answers
9 views

Custom action in meta box

I have added a meta box to the order info page on WooCommerce but can grasp how I can run an action on the order? I have created the box using: /** * Part to add a meta box to the order info page ...
0
votes
1answer
28 views

How wordpress plugin hooks works? [duplicate]

I am new to wordpress development. I am familiar with joomla's ins-and-out working mechanish, now i want to contribute or say learn wordpress. I found that every thing in wordpress is done through ...
0
votes
1answer
38 views

add_action and do_action

I am trying to hook a function to wp_head that adds some meta tags, but I does not work correctly. Here is my code: add_action( 'wp_head', 'add_meta_tags' , 2, 1 ); ...
0
votes
1answer
26 views

Other than save_post any other actions on add / edit post screen?

When the add post or edit post screens load, is there an action other than save_post which I can hook on to? I need to make an API request before a user starts adding / editing posts. Basically when ...
1
vote
0answers
35 views

Theme elements not translating

Ive got a theme that is set-up for translating but didn't come with any translations. I used poedit to automatically detect the strings, and subsequently translated it in full. However certain ...
0
votes
1answer
26 views

action future_post returns wrong date

Hi I am using a future_post hook to capture when a scheduled post is updated like so : add_action('future_post', 'on_post_scheduled'); Then I want to send the new post date to a database, however ...
0
votes
0answers
21 views

Trigger needed when meta data is updated

I need to update a MySQL table (not any of the WP/Woo tables) when a products meta_key "_stock" is modified. The trigger needs to fire on all updates: shop sales, a CSV merge or edits by admin in the ...
0
votes
1answer
80 views

Trying to use add_action and do_action with parameters

In my themes functions.php I trying to add a function with parameters (as a test if this works, not for the functionality) and it simply doesn't work. The parameters always arrive empty even if I ...