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

learn more… | top users | synonyms (2)

0
votes
1answer
2k 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 ...
1
vote
1answer
232 views

Add/remove action on jQuery toggle

I have Ajax setup and I'm trying to toggle a function from being loaded into wp_head. It works on the first toggle function, but the second function doesn't register. function ...
3
votes
2answers
94 views

How to count number of functions attached to an action hook?

I have some actions like this function simple_notification() { echo '<div>This is a notification</div>'; } add_action( 'site_notices', 'simple_notification' ); ...
0
votes
3answers
75 views

Finding actual functions added to hooks and filters

I'm trying to figure out how to find the actual function that's assigned to hooks and filters. I've been looking at other questions asked here and found a couple plugins that are helpful for findings ...
0
votes
1answer
619 views

publish_post action hook not working

I've got a really simple problem here, and i'm sure that the solution is going to be really simple. Here is the code: function the_fat_lady_sings() { echo 'this plugin is a far harder than i ...
0
votes
1answer
123 views

template_redirect not being called when using ajax

Usually I hook all my custom plugins code with the template_redirect hook but one of the issue I encountered is it does not work for the ajax call. So if I want to target both standard calls and ajax ...
0
votes
1answer
58 views

Modify functions.php to add a term 'uses-theme' set to theme name on post save

I need to automatically (without anything visible to the user in the UI and without user intervention) 'mark' a post in a sub-blog with the theme it was set to when the user posted. As I understand ...
1
vote
0answers
155 views

Save modified Custom Field content into another Custom Field on article save [closed]

In my articles I allow editors to enter a date in a human readable dd.mm.yyyy format into a custom field. But I also need this date as unix timestamp in the DB. So I wrote a function which takes the ...
0
votes
1answer
127 views

Can admin_bar_menu or another action be used to modify the admin bar on the admin side?

I have used add_action('admin_bar_menu', 'modify_admin_bar') to change the admin bar on the "front end" of WordPress (the site the user sees). However, it seems that modify_admin_bar() is not called ...
1
vote
1answer
316 views

Count singular post views automatically

I'm trying to add some function to each loop called in the themes. What I'm doing is I add a function to count post view from here post views without plugin, to use the function I need to add this ...
2
votes
1answer
582 views

How to redirect to action on custom page within admin section

Currently I'm developing(well at least trying to;) plugin which will handle custom gallery of images. I stumbled upon one problem though. I'll try to picture it. I've created custom menu page on ...
1
vote
0answers
61 views

How to prevent further updates of custom meta when using actions to set one meta based on another

I'm using rilwis' Meta Box plugin (see https://github.com/rilwis/meta-box) to add custom meta boxes to a custom post type. I then want to populate one piece of meta data based on the value of ...
2
votes
1answer
176 views

Post IDs missing on delete_postmeta action hook

I'm using metadata in pages to store variables and do server side caching for dynamic generated PayPal buttons and other variables about the pages (page specific). I'm trying to hook the page meta ...
0
votes
2answers
456 views

Trying to get custom js files in my admin header

I'm trying to add a java script file to my admin header and use admin-ajax.php to use ajax in my wp-admin (still learning a lot about the process). I've created a custom folder in my ...
0
votes
1answer
257 views

Call do_action class's function

There is the following do_action else do_action( 'example', $this->nothing()); Where nothing() does exactly what it sounds like. This logic is in a public function testFunction in a class ...
0
votes
1answer
158 views

How to get the group_id from the “groups_join_group” action in buddypress [closed]

I want to get the GROUP_creator_id when an user joins any GROUP. So if I got the group_id after immediately performing the the groups_join_group action by add_action() method.
1
vote
3answers
100 views

When to use actions and when to use filters

I'm trying to understand where to use filters and where to use actions. Suppose I have a query in a plugin, which later add on modules might modify to change the results of the query, thus modifying ...
1
vote
2answers
4k views

Woocommerce Change placement with wrapper

I am trying to change placement of Price from top to beside the Add to Cart button and want to wrap Price and Add to cart button (form) both with one div. I dont know either it is bad way or correct ...
0
votes
1answer
292 views

frontend show edit profile with selected custom options

So I have many custom user profile fields. When I use do_action( 'show_user_profile', $profileuser ); hook it displays all custom user profile fields.. But I would like to show only certain fields. ...
1
vote
3answers
1k views

Using get_terms for custom taxonomy in functions.php

I`m trying to retrieve the names of taxonomy items and include them into a theme admin panel. function retrieve_my_terms() { global $terms; $terms = get_terms('taxonomy'); foreach ...
0
votes
1answer
139 views

Replace function in a child theme

Is there a way to replace a function by another function in a child theme? In other words, in a theme there is a function named "theme_function" and this function is called by several files inside the ...
3
votes
2answers
2k views

Check if action hook exists before adding actions to it

I am trying to add a rel=next and rel=prev link tags to the head element of image.php template file. I have Wordpress SEO installed and I like to hook to this plugin wpseo_head action hook to achieve ...
0
votes
2answers
642 views

How to use the do_action () with parameter

I am trying to trigger an action in functions.php with the do_action() function, but I appear to need an attribute. The following do_action( 'really_simple_share button="facebook_like"'); does not ...
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 ...
0
votes
1answer
178 views

function to return comma separated list of meta values

I'm customizing the admin edit.php screen and I have a column that displays a meta key $gear. But it only lists the first value instead of returning a list of all the values. Here's the bit that ...
0
votes
1answer
628 views

Displaying custom taxonomy in the admin list of a custom post type

I'm trying to list the terms of a custom taxonomy ('genre') in the overview table in the admin area for a custom post type ('station'). To get this, I tried the following code in my theme's ...
0
votes
1answer
129 views

remove_action returns FALSE

I'm trying to remove the canonical link reference from my page headers and I'm using the following code in my functions.php: remove_action('wp_head', 'rel_canonical'); However, when I test the ...
0
votes
2answers
226 views

Auto-Tweet if Type is 'Status' using OAuth

Should be simple - I'd like WP to tweet the content of a post once (when it's published the first time) if the post format is 'status'. The code below isn't returning an error on publish, nor is it ...
2
votes
1answer
126 views

Which filter/action hook gets triggered after a query has been performed?

Is there an action or filter that gets called after an instance of WP_Query performs a query?
0
votes
1answer
262 views

stumped on add_action hook to delete_comment - any ideas?

I'm pretty new to plugins and trying to run a function when deleting a comment. This entails hooking into "delete_comment" if I'm not mistaken. ...
1
vote
1answer
554 views

Get list of registered or enqued styles? looking for filters or actions

Where can I get the list of styles about to be printed? What i want is to either filter the list, doing what i want with each, then return empty list. Or do an action that recieves the list, then i ...
0
votes
1answer
348 views

Custom action on comment post

Whenever a user posts a comment, I'd like to basically have a copy of the post sent to another database for a separate site. The database part is simple, but I can't seem to find the right action hook ...
0
votes
1answer
34 views

Declaring arguments for taxonomy

Just a bugbear about declaring taxonomies, reading Justin Tadlocks article about Taxonomies and want to find what does the 0 mean in this snippet from the above article: add_action( 'init', ...
0
votes
2answers
854 views

passing parameters to do action from shortcode to wp_footer

Driving me nuts. I have a shortcode which works -fine- but for one detail. I won't post the entire thing, but it pulls the content of a post (works fine) then should echo a portion of it to a new DIV ...
1
vote
4answers
6k views

Change which sidebar get_sidebar() gets from functions.php

I have this code in a template file, which loads sidebar-sidebar_a.php: get_sidebar('sidebar_a'); I would like to add a function to sidebar.php which has the effect of changing that to this if some ...
-2
votes
1answer
129 views

add_action failed to display function by a plugin

I am using a plugin which has the following function: See end of question. And I've created a hook in my template file: <?php custom_hook(); ?> And this is what I have in my functions.php ...
2
votes
1answer
379 views

remove_action with profile_personal_options

I'd like to remove the action profile_personal_options (more specifically the color scheme and visual editor checkbox) which shows up in wp-admin/user-edit.php. I believe it's as simple as running it ...
3
votes
1answer
255 views

Looking for a hook to add attachment information to the media library tab

I would like to be able to determine if an image has been attached to a post by looking at the collapsed viewmedia library tab. Is there's a hook I can use to add that data to this view of the Media ...
1
vote
1answer
968 views

Add action hook conditionally - only when home.php in use

I am trying to add action hook in functions.php only if the page is home.php but the following does not work if ( is_page_template("home.php") ) { // do stuff } To make sure that file being used ...
2
votes
1answer
175 views

How to debug removal of rewrite rule flushing?

I use Custom Post Types. I try this: functions.php add_action( 'admin_init', 'flush_rewrite_rules' ); Now I’d like to remove this again. I try this: remove_action( 'admin_init', ...
0
votes
1answer
172 views

create 2 custom columns in page edit in Admin panel

Hey all i have this code here: if ( !function_exists('AddThumbColumn') && function_exists('add_theme_support') ) { // for post and page add_theme_support('post-thumbnails', array( ...
0
votes
2answers
90 views

Action hook for editing post

I'm looking for the add_action() hook for when a current post is edited and saved. I know there's edit_post and save_post, but I'm looking for something that ONLY fires when a current post is edited, ...
0
votes
1answer
287 views

Redirect user if they are not logged in

If user enters the url www.abc.com in the browser and he is not logged in, then we want to redirect him to www.abc.com/de. How can I do this within WordPress?
1
vote
2answers
443 views

My plugin class doesn't work! [closed]

Long story short; I'm writing a plugin in OOP. The constructor is run, but the callback of my add_action does not run. I just can't find out why. I have added echo's on different spots to see what ...
1
vote
1answer
148 views

How to call bind function in wordpress actions or hooks

I have made a class file in my plugin folder. Then I wrote, class Sample{ function footer_content(){ echo "show any data"; } } Then I added the function footer_content to wordpress ...
6
votes
2answers
118 views

Valid characters for actions, hooks and filters

I haven't ever seen a tag such as do_action('something_10'). Is it invalid if I use numbers? If the method is valid, how can I write different numbers in the tag string conditionally? For example, is ...
1
vote
1answer
2k views

add_action in functions.php, do_action in plugin?

I am trying to set an add_action function in my currently active WordPress theme functions.php file, for a defined do_action function within an activated WordPress plugin. The add_action function in ...
1
vote
2answers
655 views

do_action pass array argument as reference not copy [duplicate]

I have successive hooks to an action which are passed an associative array like: do_action($array) I am trying to update the values in this array in the multiple add_action calls, however each ...
0
votes
1answer
803 views

Using auth_redirect returns cannot modify header information

I'm hooking auth_redirect to wp_head, but it's returning cannot modify header information. Do I have to hook it to a different action? Something that loads before wp_head? I tried hooking it to ...
3
votes
1answer
481 views

Do I need to call do_action in my plugin?

Do I need to call do_action function every time I add_action something?