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

learn more… | top users | synonyms (2)

0
votes
2answers
970 views

update_user_meta not updating

I'm trying to force password change upon first user login, which overall is not working, but so far I find a problem update_user_meta() is not updating at all, this is my code: function ...
1
vote
1answer
407 views

Looking for a hook for post.php

First time posting here... I am trying to figure out if there is a hook or action that I can use when a user goes to wp-admin/post.php... Basically when the user goes to post.php I want to check if ...
4
votes
1answer
836 views

How to change “Draft” string for status of custom post type to “Unavailable”?

ANSWER MOD: just an important mod to the chosen answer: // check if you actually have drafts; also avoids extra '|' separator if (isset($views['draft'])) { // 'Drafts' should be added (and come ...
0
votes
1answer
284 views

do add_action on condition

This snippet for example will email on EVERY post: function email_friends( $post_ID ) { $friends = 'bob@example.org, susie@example.org'; wp_mail( $friends, "sally's blog updated", 'I just put ...
0
votes
1answer
74 views

Wordpress Plugin Receive a Link

I'm writing a Wordpress plugin. The plugin should allow every user to rate posts (1 to 5 stars). What actually works is to read the rating from storage and show the stars. So there are five <a> ...
0
votes
1answer
59 views

Running a function with args in add_action()

I've created a plugin, and it has a function that takes two args, like so: process($tokens, $payloads); ... would this work? : add_action ( 'publish_post', process($tokens, $payloads) ); Many ...
4
votes
1answer
1k views

Create posts on user registration

How can I create let say 3 posts after the user finish the registration ? The ideal outcome would be to create 3 posts using the user as the author of the posts and with some pre-defined values. ...
1
vote
1answer
109 views

Valid filenames for add_action's first parameter

Some examples in WordPress' docs pass a filename to add_action rather than an action name. For example, add_action( 'load-post.php', 'callback' ); add_action( 'load-post-new.php', 'callback' ); ...
4
votes
1answer
171 views

Store source permalink on XMLRPC calls

In a theme I'm developing, I need to link to the source post when the post has been stored using XMLRPC. That implies that every time Wordpress asks for a permalink (using get_permalink()) the theme ...
-1
votes
1answer
499 views

publish_post action doesn't work

i'm developing a small plugin which will send email to users when a new magazine is published. i made a post type name "magazine" on the theme functions.php. and i wrote a plugin for email ...
2
votes
3answers
2k views

A Post is saved twice or more during add_action(save_post)

I have added a custom meta box for advanced information for a specific post category, to my create new post page. Now I recognize, that if I save the post, it writes 2 entries in the db with 2 ...
1
vote
1answer
311 views

Which action does wp_update_user triggers?

I am working modifying an ecommerce plugin, and it makes uses of wp_update_user() function, and everytime the function runs another table (created by the plugin), gets updated too. The problem is that ...
-1
votes
1answer
89 views

Action while post is being published

I modified the wordpress admin with a plugin I wrote, and my last problem is that there's no action anymore while the post is being updated or published in the admin. I looked around for a function or ...
0
votes
1answer
42 views

Create WordPress taxonomies based on theme settings

Is it possible to create taxonomies based on theme settings? That is, are theme settings actions run before taxonomies / post types are initialized?
4
votes
1answer
100 views

Getting the action's tag name within the action

There's a function attached to a set of actions, like this: add_action('some_tag', 'the_function'); function the_function($maybe_some_vars){ // ... } Is it possible to find out the action name ...
1
vote
3answers
683 views

Is there a recover_post hook to go with trash_post hook?

I'm using the trash_post hook to set a flag in a custom table to indicate that this item is "deleted", but when the user chooses to restore that post, what hook can I use for that? I couldn't find ...
4
votes
1answer
110 views

How Do I Load My Action Earlier Enough?

With add_action, I want to intercept as early as I can in my plugin and send a 304 Not Modified header per some rules. Does anyone know what the order is of events? When I view this page, it seems to ...
0
votes
2answers
3k views

How to use create_term, edit_term, delete_term actions?

I've created a Custom Taxonomy and I want to hook a function when User adds new Term to my Custom Taxonomy. Can someone please show me how to use following actions in Wordpress? create_term ...
9
votes
2answers
3k views

Why do some hooks not work inside class context?

I'm pretty stumped on this one. I'm using add_action inside my plugin class to do certain things- add scripts & styles to the head, wp_ajax, etc. Here's the actions, in the __construct: function ...
1
vote
1answer
53 views

add_actions called from functions.php not returning good values

I am trying to add some security/acccess prevention to my site via the functions.php. However whenever I try to add through functions.php (instead of as a plugin, which I've done in the past) it ...
0
votes
3answers
901 views

How to get post ID with hooks publish_post, new_to_publish, etc

I have two plugins, one uses the function wp_insert_post(), the other has a code like this: add_action('future_to_publish', 'myFunc', 10, 1); add_action('new_to_publish', 'myFunc', 10, 1); ...
0
votes
1answer
2k views

is there an update_post_meta action

Are there any actions I can hook into for update_post_meta()? I don't see anything obvious in the source. Woocommerce lets you change the featured status of items via ajax from the edit screen. I ...
9
votes
4answers
2k views

after_setup_theme always runs

I am setting up a child theme for some of my faculty members, and as a part of the theme, I would like a handful of plugins to be activated at the time that the theme is activated. So, naturally, I ...
0
votes
1answer
59 views

How do i know which action / filters are called when i call get_option()

I need to know which action / filters are called when i do a get_option() call, how can i do that?
5
votes
1answer
1k views

Difference between do_action('admin_enqueue_scripts', $hook_suffix) and do_action(“admin_print_styles-$hook_suffix”) syntax

Source ref: do_action('admin_enqueue_scripts', $hook_suffix); do_action("admin_print_styles-$hook_suffix"); Laying aside the obvious difference in base action ( admin_enqueue_scripts vs ...
1
vote
1answer
834 views

Get the post_id of a new post

There are several ways to get the id of a post after it has been saved (auto, etc.), but is there a way to get the post id immediately after you create a new post? I am trying to create a directory ...
2
votes
1answer
917 views

Add something to beginning of content with add_action('the_content')?

I'm using add_action('the_content', 'myFunction', 10) to append data to the end of the content. How can I place content at the beginning of the content?
0
votes
2answers
2k views

How to append new form elements in “Add New” form of Users in Wordpress admin panel?

I'm developing a WordPress plugin and I want to append some extra form fields in add new form of Users section inside admin panel without editing core files. Can somebody help me in achieving this.
0
votes
1answer
115 views

Bug: Post needs to be updated twice when adding action for save_post hook

My function does exactly what I want it to do: I'm trying to add/update meta fields in another post type when an "events" post is saved. Except the post needs to be updated twice for the information ...
0
votes
2answers
1k views

When is admin_init Action ran?

I have this function below that is called with the admin_init Action function my_flush_rewrites() { global $wp_rewrite; $wp_rewrite->flush_rules(); } Like this ...
2
votes
1answer
536 views

add_action 'manage_posts_custom_column' in a class [closed]

I think this may be more of a general php question but I am posting it here as it relates to a WP function. I am having some issues with an add_action on manage_posts_custom_column inside a class. ...
8
votes
5answers
7k 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' ...
0
votes
1answer
51 views

How can I get more out of `$post` in an `add_action` callback?

I have the following action callback set up: function abc_save_post($post_id, $post) { // do stuff echo '<pre>'.print_r($post,true).'</pre>'; } add_action('save_post', ...
2
votes
2answers
2k views

Why is `add_meta_box` not working?

I'm trying to add some meta fields to a WPSC product using the following code: /** * data callback */ function abc_callback($object, $box) { echo 'callback executed!'; } /** * add custom ...
1
vote
4answers
284 views

Remove action from shortcode

There is add_action() function inside function which is callback for add_shortcode(). Any idea how to remove this action with the help of custom plugin? Should I hook to any action which is called ...
2
votes
1answer
2k views

How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?

How can I remove "Proudly powered by WordPress" from twentyeleven without modifying footer.php, and without creating a child theme? I'm looking for a php command, such as add_action, remove_action, ...
2
votes
1answer
1k views

add_action in a function, is it possible?

I am trying to add some js to the head using add_action('wp_head', 'js_func'); which works when posted just after the function, however I do not want it posted on every page, just the page that it's ...
1
vote
2answers
662 views

action lifecycle

I'm looking for a documentation page where wordpress action lifecycle is explained. Does it exist? I can't understand if init is called before admin_head or viceversa (even if the name is ...
24
votes
1answer
5k views

Passing a parameter to filter and action functions

Is a way to pass my own parameters to the function in add_filter or add_action. For example take a look in the following code: function my_content($content, $my_param) { do something... using ...
1
vote
0answers
70 views

Selectively applying action based on role

I've added an action to my functions.php file that forces a plugin (Content Scheduler) to act on posts, even when it wasn't explicitly enabled by the person writing the post. I've got that working, ...
3
votes
1answer
85 views

How do I know if author field was changed on post save?

I'm writing a plugin that sends notifications on various post events. One of the notifications should be sent when a post is assigned to a different author. How can I know that the post author was ...
1
vote
2answers
795 views

where is the documentation for add_action() parameters?

I am reading the source of a plugin (gallery to slideshow plugin) to make it behave like i want and it is using an action add_action( 'the_posts', array( &$this, 'have_gallery' ), 10, 1 ); I ...
0
votes
1answer
2k views

add_action hook for publish_post not working

I can't get my function to trigger on post update or save. I've found a couple of other forum posts around with the same problem, but never an answer :( My code is as simple as: function ...
0
votes
1answer
207 views

Missing argument for the function

do you know why i am missing argument 2 for this function? add_action( 'admin_notices', 'notice_handler', 10, 2); function notice_handler($error_token, $error_tag) { ... } } but when i ...
0
votes
1answer
413 views

Adding tables to dashboard pages programmatically?

I think that is not possible with some actions or filters, I know that I can do it just with html and using right css styles, and of course php to achieve what I need, or to write some minde actions. ...
0
votes
2answers
255 views

Custom Post type forgetting data

I just set up a custom post type, mostly following this tutorial. I'm setting up things on my site now, doing a lot of CSS modifications and such, and every few minutes the post just forgets ...
4
votes
3answers
5k views

Perform an action when post is updated/published

I'd like to run a custom query using some meta data whenever a post is updated or published. Is there something I can put in functions.php to fire when those events occur?
2
votes
2answers
721 views

Can an action callback prevent the parent from continuing execution?

I'm working on a plugin that interacts with Gravity Forms, and under certain conditions I want to prevent a form from being deleted. Here's the method in Gravity Forms that handles deleting a form: ...
2
votes
2answers
131 views

What's the best action to use when you want to do something only once per theme setup?

I'm writing a theme which has it's own set of database tables. I'm wondering what is the best action for me to use when I want my install function to be invoked only once when the theme is activated ...
6
votes
1answer
3k views

How to override existing plugin action with new action

I'm using a plugin. It has an action like this. add_action('publish_post', 'old_action'); function old_action($pid) { "code goes here" } } I'm writing a module for this plugin. So i need to ...