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

learn more… | top users | synonyms (2)

0
votes
2answers
787 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
5k 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
126 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
250 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
249 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
856 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
164 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
160 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
88 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
278 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
416 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
145 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
115 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
612 views

do_action pass array argument as reference not copy

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
759 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
394 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
84 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 ...
6
votes
2answers
1k views

Extract image from content and set it as the featured image

The problem: I'm posting from the Wordpress iPhone app. When adding an image, the image shows up in the description itself, which I don't like. What I'm trying to do: Remove the image from the ...
0
votes
2answers
133 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
258 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 ...
0
votes
1answer
281 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 ...
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 ...
0
votes
1answer
49 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
338 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
339 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 ...
2
votes
2answers
1k views

add_action for saving a custom menu

Say you have custom menus enabled with your WP theme. Is there any action associated with saving a menu once you've arranged it accordingly? To further clarify: say you've arranged a menu with some ...
1
vote
1answer
133 views

Stop loading “collaborators” users on add new post or page?

So our website has about 20k "collaborators" type of users and we'd like to stop loading all of them on the select box on the "add new post" or "add new page" PAGE. Maybe load only authors and above ...
-2
votes
3answers
154 views

Apply function on all action hooks?

Is there an easy way to apply a function on all action hooks? I want to apply esc_attr() to every action hook (in a way that would work from functions.php or a plugin). I figure I would need ...
0
votes
1answer
57 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" ...
1
vote
1answer
576 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 ...
2
votes
1answer
484 views

PHP5, Inheritance, Singleton - action & filter hook limitations

I'm currently working on a plugin, which uses the builtin cron functionality of wordpress. Instead of using PHP4, I want to use PHP5 with inheritance and the singleton design pattern. I run in some ...
0
votes
1answer
503 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 ...
2
votes
1answer
169 views

How to update feed only 2-3 times a week (for Feedburner email)?

So many of you know that Feedburner is a great (free) tool for sending out newsletters. The problem is that if you add content everyday, everyday emails will be sent out. I'd like to control on ...
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 ...
1
vote
2answers
1k views

How do I hook a sidebar via add_action?

On one of my templates I have an action hook 'do_xyz' I want to attach a custom sidebar to the action hook do_xyz Here is what I am trying in my theme functions.php file, does not work: ...
1
vote
1answer
494 views

Does BuddyPress Have An Action Hook for remove_user? [closed]

BuddyPress has a behavior for removing users that does not run through WP's deleted_user action. I have a hook in my plugin for add_action('deleted_user', 'myScript'); but it only works for ...
3
votes
1answer
1k views

Using action hooks inside of a shortcode

I am trying to create a modular plugin that includes action hooks for developers to add content before and after the main shortcode content. I'm having some trouble because anything I do in the ...
1
vote
0answers
67 views

Submit custom form from post content and execute in plugin

I have prepared custom form (quiz plugin) with embedding in custom posts via {{QUIZ_ID}} placeholder. My form is displayed in post correctly but bigger problem is what form action should I create (and ...
0
votes
1answer
131 views

An action that runs after each post in the loop on index/archive page?

Is there an Action/a Filter that runs just after each post/post excerpt is displayed on these 2 pages? I use the_content and get_the_excerpt currently, but the_content causes a conflict with some ...
1
vote
1answer
188 views

Combining action and filter?

I tried to set up different video oembed size for content and sidebar. I can set up video size with embed_defaults filter. But this filter works for the whole site and I need to have smaller video ...
1
vote
1answer
36 views

How to select a page within admin?

How does one apply an action to one particular page within admin? I've added a bunch of wysiwyg editors to one page ("Home") and now I don't need the main editor. But the function below - of course - ...
1
vote
2answers
506 views

What would cause the 'wp' action to fire twice per page (but only once per post) in Firefox only?

I'm using add_action( 'wp', 'do_something_once_per_page' ); and, well, it's not doing it just once but twice. What's interesting is that within do_something_once_per_page( $wp ){ } I'm globalizing ...
2
votes
1answer
692 views

Better way to enforce category hierarchy in post_categories_metabox?

The objective is to ensure that when editing a post, the metabox that lists a hierarchical taxonomy doesn't reorder itself upon Update to put checked items on top. Right now, edit-form-advanced.php ...
0
votes
1answer
196 views

add_action() in switch statement

I'm using the approach of having all of my single-views in one loop-single.php and thus have a simple switch statement that will render each single-view based on the post type: ...
3
votes
3answers
2k views

How to correctly get post type in a the_title filter

I want to prepend text to the post titles of a specific custom post type, but the filter below didn't work. Instead of changing only that CPT's post titles, it changed all titles on the given CPT's ...
1
vote
2answers
325 views

WP_cron won't trigger my action

I'm in a dead end with a schedualed task in a wordpress plugin for a multisite. Somehow the action I added don't get triggered. The task is getting schedualed and returns a timestamp when I run ...
4
votes
1answer
837 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
212 views

OOP Plugin: Where should I place the action hooks in the class?

Where in my admin class should I place the action hooks for adding css, scripts and the add menu page? In the __construct? Or should they be placed in a method?