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

learn more… | top users | synonyms (2)

0
votes
1answer
133 views

Change meta tags programatically

Is there a way to change the meta tags not in the head but in a template file through code? I would like to change the meta tags <meta property="og:title" content="title" /> <meta ...
0
votes
1answer
20 views

Where to place add_action when enqueueing?

Do I place add_action before or after function myTheme_script {enqueue functions here} when enqueueing a script or stylesheet into functions.php, or does it matter? I'm seeing both from moderators on ...
1
vote
1answer
83 views

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
0answers
13 views

after_switch_theme not working in a class? [duplicate]

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')); ...
0
votes
5answers
3k views

Remove meta robots tag from wp_head

I am in need to remove just this line <meta name=robots content="noindex,follow"/> from wp_head but can't find the right hook to use it with remove_action(). <meta name=robots ...
5
votes
1answer
107 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
32 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
20 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
33 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 ...
0
votes
1answer
3k views

Using the 'draft_to_publish' hook (post status transition)

I am trying to use the draft_to_publish hook (http://codex.wordpress.org/Post_Status_Transitions) to run a function when a post that is a draft becomes published. This hook does not appear to be ...
0
votes
3answers
31 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
30 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
2answers
54 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
87 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
104 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
0answers
24 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
126 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
78 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
1answer
103 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
0answers
27 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
233 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 ...
0
votes
1answer
160 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
102 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
98 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
69 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 ...
11
votes
6answers
11k views

add_action reference a class

Is it possible to reference a class instead of a function in 'add_action'? Can't seem to figure it out. Here is just a basic example of the function in question. add_action( 'admin_init', 'MyClass' ...
1
vote
2answers
39 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
65 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 ...
2
votes
1answer
78 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
53 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
66 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
116 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? ...
2
votes
2answers
1k views

How to use filter hook 'post_updated_messages' in coherence with action hook 'save_post'

I am trying to send out e-mail, SMS and IM notifications to group members of this WordPress website, whenever a WordPress page in their user group has been published/updated. I figured using the ...
0
votes
1answer
874 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 ...
1
vote
0answers
93 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
1answer
19 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
1answer
249 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
28 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 ...
3
votes
1answer
1k views

Check if post is being published for the first time, or is an already published post being updated

I am building an add-on to an events module that checks for availability, since there wasn't a function for that in that module. Now that I have built the logic, there are three emails I will need to ...
0
votes
0answers
34 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
57 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
71 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 ...
1
vote
1answer
4k views

Disable WooCommerce action

I'm customizing a WooCommerce theme and am going to be moving the title. There is an action in content-single-product.php called: do_action( 'woocommerce_single_product_summary' ); in the ...
0
votes
1answer
150 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
34 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
139 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, ...
0
votes
1answer
72 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 = ...
6
votes
1answer
63 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
60 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
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 ) ...