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

learn more… | top users | synonyms (2)

0
votes
1answer
275 views

Dynamic wp_enqueue_scripts?

Is it possible to call wp_enqueue_scripts dynamically? For example, I want to use in function.php my own function addThemeJS( true, 'modernizr', THEME_JS_DIR . "/plugins/modernizr.custom.js", ...
0
votes
1answer
280 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
186 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
101 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 ...
0
votes
1answer
308 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
146 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
810 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 ...
0
votes
1answer
199 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
132 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
1answer
697 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
2answers
230 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
161 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?
3
votes
5answers
493 views

How do I make a theme “plugin-ready”?

How do I revise a theme so that I can publish my event hooks and anyone can build a plugin to add new functionality easily to my theme?
0
votes
1answer
305 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. ...
0
votes
1answer
35 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
926 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 ...
-2
votes
1answer
138 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 ...
1
vote
1answer
1k 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
394 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 ...
2
votes
1answer
202 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
188 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( ...
4
votes
2answers
2k views

add_action(), add_filter() before or after function

When looking through WordPress snippets/tutorials/plugins I often see add_action() and add_filter() being placed before the function is declared: add_action( 'publish_post', 'email_friends' ); ...
0
votes
2answers
91 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
299 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
472 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
156 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 ...
0
votes
1answer
376 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 ...
6
votes
2answers
126 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
861 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 ...
1
vote
2answers
727 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 ...
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 ...
3
votes
1answer
580 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?
1
vote
0answers
87 views

Copy post to separate database with “add_action(…)”

I'm basically trying to have a copy of a post be sent to another database's table when it's published. I've gotten it to add a new row in the new table, with my own static arguments, but I'm not sure ...
2
votes
4answers
7k 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 ...
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 ...
1
vote
2answers
172 views

need help looping add_action in wp

i would like to know the proper way to do this $dynValue=5;//loop this many times //start of my loop for ($num=1; $num <= $dynValue; $num++){ //note the incremented number ($num) in the call back ...
0
votes
1answer
354 views

Is there any action/filter hook to use when an image gets edited in the editor?

I can't find a specific hook. If I already have added an image to an article via editor and then I edit it, I'd like to intercept the code just before it is sent again to the editor. I already use ...
0
votes
0answers
74 views

Add new template file in plugin [duplicate]

Possible Duplicate: Create custom page templates with plugins? I create a plugin and a template file but I do not know how to include the template file in the plugin For the moment, I use ...
-1
votes
3answers
482 views

Proper method to restrict non logged users into certain pages

I was wondering which is the correct method to do this and which action hook should i use. I have custom login/register pages so if the user try to go to a forbidden page and its not logged in i ...
0
votes
1answer
53 views

How Can I Add Code To A Preexisting Function Without Editing it

This is what I am trying to do: Lets say I have a parent plugin, Plugin X, and a child plugin (an extension, whose purpose is to enhance X) Y. There is a function in plugin X that I wish to add ...
2
votes
2answers
403 views

add_action in class and use it in theme

I'm programming a plugin in Wordpress and want to access some database functions with in my theme with the do_action feature. First I just included $fdb-> get_finaboo_footer(1); on my page for example ...
0
votes
2answers
405 views

Divs appearing everywhere in post content

Whenever somebody writes a post on our site, the Paly Voice (http://palyvoice.com) there are automatically a lot of <div> elements created. This is bad for layout, since we have a style that ...
0
votes
1answer
352 views

What filter or action hook to use in order to load some code before the template begins printing in BuddyPress? [closed]

I would like to load some code before the template begins printing in BuddyPress. What filter or action hook should I use? I tried a number of them (such as bp_head, bp_include, bp_init), but none of ...
1
vote
1answer
651 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
3answers
151 views

About Hooks and Filters

Well, am having a very hard time understanding the difference between Actions and Filters. I do use actions in my code, but am a rookie and I don't know even a slightest bit of Filters. I have been ...
1
vote
1answer
739 views

wp_get_attachment_metadata returns false with add_action() 'add_attachment' hook

With the following code in functions.php - wp_get_attachment_metadata() returns false and or empty. Perhaps I am attempting to use wp_get_attachment_metadata() before it's ready? As some tests have ...
0
votes
1answer
58 views

Running a wordpress action when a custom post type term (taxonomy category) is changed

Trying to make a system whereby a function is called upon an admin changing the taxonomy category (term - if i understand correcrtly) of a custom post type. I thought the action tag "edit_category" ...
0
votes
1answer
569 views

How to display message (with switch_theme hook) after deactivating My theme?

I'm able to display a message by activation of my theme with the 'new' after_switch_theme hook this way: function themeActivationFunction($oldname, $oldtheme=false) { $msg = ' <div ...