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

learn more… | top users | synonyms (2)

0
votes
1answer
25 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
30 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
36 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
22 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
16 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
38 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
32 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
115 views
+50

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
47 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
16 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
18 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', ...
-1
votes
0answers
10 views

Plugin hook that only fires when a new post is published? [duplicate]

I wrote a plugin for my site which posts an update on my forum whenever a new post is published. I'm using the "publish_post" and "publish_future_post" actions. The problem is, these actions also ...
0
votes
0answers
23 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
132 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
19 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
59 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
21 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
31 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
35 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
44 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
15 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
36 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
36 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
25 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
34 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
29 views

How to call plugin function everytime

This is probably a very basic and simple matter, but what is the command to call a function in my plugin every time the page is loaded? I think it is something like add_action() or do_action(). ...
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
8 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
26 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
36 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
20 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
32 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
23 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
19 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
73 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 ...
0
votes
1answer
29 views

How To Get User Data in Callback Function for pre_user_nicename?

Whenever I update a user profile in the dashboard, the user nice-name gets changed in the database: Every time, a "-2" is added. I tried to reset the nicename (based loosely on this thread) by ...
0
votes
3answers
100 views

How to use return in my custom function instead of echo

I'm creating a function in functions.php with a custom hook, and from what I've read somewhere, it's good practice to return instead of use echo in a WordPress function? Correct me if I'm wrong. ...
0
votes
2answers
43 views

Trying to write a function in an external php file to manage admin menu visibility

I am loading my php file by putting this into my theme's functions.php: require get_stylesheet_directory() . '/inc/manage-menus.php'; alter_menu('my-user', 'plugins.php', false); The code in ...
1
vote
0answers
75 views

Having an add_action( 'user_new_form',)

I am using the following action; add_action( 'user_new_form', 'epx_add_user_form_to_admin_area',489); function epx_add_user_form_to_admin_area($current){ $current .= 'this is a test'; echo ...
0
votes
1answer
13 views

Never actually adding the action? Or do I have to call the action?

I have the following class that is instantiated in the function.php file. In the constructor I am setting up a activation and a deactivation hook for the theme. How ever neither seem to be called when ...
0
votes
3answers
59 views

Add action to fire when a published post is updated

I have a couple of actions setup: add_action('publish_post', array($this, 'newPost'), 10, 2); add_action('post_updated', array($this, 'updatePost'), 10, 3); When I update an already published post ...
0
votes
0answers
18 views

Setup lazyload on post images using get_image_tag

According to jQuery.lazyload any images I'd like to "lazyload" need to have the src attribute replaced with data-original. I'm assuming I can do this using WP's get_image_tag filter, but I'm stuck on ...
0
votes
1answer
67 views

Can a plugin add to header/footer/body content?

I am just wrapping up my first WordPress plugin and the last thing I would like to do is take a piece of data that the plugin knows about (from wp_options table) and display it in either the header or ...
0
votes
0answers
32 views

do_action filter function from add_action array

I am looking at the following setup: -- Combing multiple functions into single action -- add_action( 'single_post_meta_start', array( $this, 'the_title' ), 10 ); add_action( ...
0
votes
1answer
34 views

Getting error while trying to use custom comment function

I'm trying to write a function that will allow me more control over the display of comments on a post page. However I'm confused about how to set it up so WordPress can use it. right now I get the ...
0
votes
1answer
55 views

Use external link in the add sub menu

I want to show the data in the external plugins.php file. the below url path is correct but its not showing the file data. Whats the problem? add_submenu_page( 'antify', 'Plugins', 'Plugins', ...
0
votes
1answer
28 views

Plugin Development - Functions or Hooks?

I am brand new to WordPress plugin development and have a few questions, mostly about best practices but also some specifics. Essentially I just want to trigger an action (invoking a PHP class and ...