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

learn more… | top users | synonyms (2)

2
votes
1answer
961 views

Dynamically Create Terms in Taxonomy when Custom Post Type is Published. Almost There!

I'm trying to automatically create terms in a certain taxonomy when a certain custom post type is published. The newly created term must be the name of the post that was published. Example: I have a ...
3
votes
2answers
737 views

Correct place to register and enqueue scripts

I'm queueing several scripts in my themes Functions.php: if ( ! function_exists('b99_init_scripts') ) : function b99_init_scripts(){ if ( !is_admin()){ ...
0
votes
1answer
197 views

Which hook to use when adding ajax to viewer-facing side?

I have a shortcode that contains a form. I want to use jQuery/Ajax for POSTing. For this, I want to add javascript to the page where shortcode is added? Which hook should I use? wp_enqueue_scripts ...
14
votes
1answer
4k views

Why does save_post action fire when creating a new post?

I'm surprised by the fact that my function that I've tacked onto the save_post action fires when I click the "New Post" link in the Admin Dashboard. Note - this is before I've pressed Save or Update, ...
3
votes
4answers
2k views

Unregister post type from child theme

I'm trying to unregister a post type from a child theme but I haven't been able to do so, the code in the funcions.php file on the parent theme is something like this: add_action( 'init', ...
0
votes
1answer
238 views

I add some js files from a plugin to a specific location

How Can I add some js files from a plugin to a specific location with add_action I am Using this widget: ...
1
vote
2answers
1k views

What hook should be used to programmatically create a post only when master post is updated?

Pippin and Jean-Baptiste Jung have very good tutorials on how to programmatically create content when a new post is published using these four actions hooks... publish{post_type} ...
0
votes
1answer
349 views

Fix warning: Missing argument

i want to submit a theme to the wordpress.org. when i put the define('WP_DEBUG', true); in my wp-config.php. my theme showed some errors.but i don't know how to correct theme. Q1:Warning: Missing ...
1
vote
1answer
1k views

How can I automatically set a post slug based on the post title during post publish?

When you create a post in WP, if you don't specify a title rapidly, WP generates a default slug on autosave, based on the post ID. Then, when you add the title later, unless you modify the slug by ...
2
votes
2answers
2k views

Hook/action after WP_Query gets posts to query custom tables for post-related meta

I see that there are hooks for manipulating WP_Query before it gets its posts (parse_query, pre_get_posts), but I can't seem to find any hooks for after the WP_Query object is populated. I have a ...
6
votes
3answers
4k views

How to know what functions are hooked to an action/filter?

Is there a way to know what functions are hooked to a particular hook? For example if I'd like to know what functions are hooked to the wp_head hook.
1
vote
1answer
2k views

register_taxonomy and register_post_type does not work

I have a problem using the register_post_type and register_taxonomy on my Wordpress. I created the code on my functions.php and it does not update my panel. Why? //Categorias personalizadas ...
4
votes
2answers
2k views

Does an activated plugin automatically mean its methods are available to other WP functions?

I made a WordPress plugin like this: Class MY_CLASS { //codes } Global $myclass; $myclass = New MY_CLASS (); After installed and activated the plugin, can I use this class in other plugins without ...
3
votes
2answers
648 views

Why can't I hook into save_posts after admin_init?

I'm trying to hook into the "save_post" action from an AJAX callback in my plugin, but it doesn't seem to work. In fact, hooking into "save_posts" only seems to work from a few key action execution ...
0
votes
2answers
593 views

How to recover the post ID earlier in the WP admin hook action “firing” sequence?

I am creating a WP plugin based around Custom Post Types (CPT), where you can dynamically specify a CPT, complete with any number of associated dynamic Meta Boxes and form elements such as radio ...
0
votes
1answer
444 views

Custom post type functions.php if statement on action

I am using developing a child theme for Woothemes' Canvas. I am trying to use functions.php in the child theme to only use actions on my custom post type. This code doesn't seem to be working: ...
0
votes
1answer
103 views

How to make a function occurs for one time?

I have the following code in the functions.php file in my theme function my_func(){ echo "foo"; } add_action('admin_menu','my_func'); I assume this function "my_func" will be ...
0
votes
3answers
613 views

What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?

So the reason why I am don't want to include get_header() or get_footer() tags is because this page will be loaded as an iframe using the thickbox modal plugin and its content will be a form and I ...
3
votes
1answer
3k views

Difference between after_setup_theme and init action hooks?

What is the difference between the after_setup_theme and init action hooks? It seems they are both called right before any page in WordPress is loaded (even admin pages).
5
votes
1answer
2k views

Action hook on Edit custom post type?

Is there an explicit action hook that will fire when (or just before) the admin Edit page renders for a custom post type? Something similar to {$new_status}_{$post->post_type}? I'm trying to find the ...
2
votes
2answers
2k views

add_action('wp_ajax_[action name]', myfunction) problem

I'm having the exact same problem described in this post: add_action('wp_ajax_[action name]', myfunction) problem I set add_action('wp_ajax_my_function_call','my_ajax_function'). If I ...
2
votes
1answer
1k views

What action is called when drafts are saved?

I would like to add a metadata field to the current post based on a checkbox in a custom meta box to be able to toggle my custom plugin on a post by post basis. For this I coded the following things ...
11
votes
1answer
6k views

How to test wp_cron?

This is kind of a stupid question... I scheduled a action to run every hour: if(!wp_next_scheduled('my_hourly_events')) wp_schedule_event(time(), 'hourly', 'my_hourly_events'); ...
7
votes
2answers
2k views

Return $post_id when DOING_AUTOSAVE?

I see the following pattern over and over, on this site and on other places: add_action( 'save_post', 'wpse14169_save_post' ); function wpse14169_save_post( $post_id ) { if ( defined( ...
2
votes
2answers
1k views

What action should I hook into when adding roles and capabilities?

I'm going to be using add_role() and $role->add_cap() to set up a new custom role and attach a new capability to existing roles. I'm wondering where the best place to do this is? Obviously I can do ...
2
votes
1answer
3k views

pre get posts changing the query

i need to change the posts in taxonomy.php page. I have a meta_key which i want to compare to meta value. But currently my code is not returning anything. I am sure i am missing something. Please let ...
2
votes
1answer
834 views

Add “Page Revised” column to Admin

How would I go about adding a column to the Page Admin area that would show the last revision date of all pages? Alongside the Author and Published Date columns? I need to keep an eye on the page ...
1
vote
1answer
2k views

Create cron job without a plugin?

Basically I wrote a function that lets me change the post status to draft depending of a field in the postmeta table: /** * Remove ads if they have been sold for over 5 days */ function ...
4
votes
3answers
3k views

Which hook should be used to add an action containing a redirect?

I want to build a plugin that grabs certain url params from the query string to build a new query string for the same page. I'm following the excellent the Professional WordPress Plugin Development ...
1
vote
1answer
256 views

Does the switch_theme action run when you're upgrading a theme?

Did anyone test if this action is being executed on theme upgrade? Are there any other actions I could use to attach a theme uninstall function?
1
vote
1answer
371 views

how to set array of args for scheduled event?

I have a scheduled event that runs twice daily in my plugin, the action is registered with add_action('fhprw_action','fhprw_check_fetch'); function fhprw_check_fetch($args){ $type=$args['type']; ...
10
votes
1answer
5k views

how to limit search to post titles?

Is there a way to limit search to post titles? I know I can modify query.php core file but there must be a way to do it with hooks right? Thanks in advance!
2
votes
1answer
450 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 ...
4
votes
5answers
668 views

Implementing advanced add_* function wrappers

add_action() and add_filter() are major functions. However in some scenarios add one more function and hook it somewhere approach gets bulky and inconvenient. I had determined for myself several use ...
1
vote
3answers
288 views

How to find hooks as per Just-In-Time approach?

How can I follow Just-In-Time approach in hooking up my function to an action? I mean everybody just attach the functions to a very early stage like init which leaves the scope of optimisation. I saw ...
5
votes
2answers
3k views

Function to execute when a post is moved to trash .

Hi is there an action which can be performed while a post is moved to trash .... I tried delete_post and deleted_post. It works but twice for each action ( before and after the action as written in ...
2
votes
1answer
1k views

What is the 'admin_action_' . $_REQUEST['action'] hook used for?

There's an action hook triggered in admin.php called 'admin_action_'.$_REQUEST['action']. Unfortunately, it's a bit useless for plugins as it's triggered at the very end of admin.php, after ...
1
vote
3answers
489 views

Good tools for locating hooks in a wordpress page/admin interface/blog post?

I've recently started using the Hikari Hooks plugin for Wordpress as it seems to allow you to get a good idea of what do_actions are being called on the page, so that you can easily find out where ...
1
vote
2answers
306 views

How to get all of the activate_plugin action parameters?

I am trying to hook into activate_plugin. I know that activate_plugin has 1 required param and 2 optional ones. I am trying to acquire all 3. Here's my setup: // create plugin settings menu ...
1
vote
2answers
857 views

From what hook on is it possible to conditionally add actions?

I tried to have a siderbar registered at the "init" hook based on a variable from the theme options array indicating whether the sidebar should be used in the design. Now it appears that that the ...
0
votes
1answer
664 views

Display different number of posts from one category on the different pages

according with Pagination with custom loop. I use the custom loop for display flash game. For make a pagination on the page with posts from one category (mydomain/category/categoryName) I used: ...
2
votes
1answer
820 views

Appending meta value onto post content in WordPress during save_post

The problem seems pretty straight forward: Once the save_post action is fired, I would like to append the value of a meta key onto the end of the post_content if it's not already found within the post ...
1
vote
1answer
922 views

How to get multiple Action Hooks in an Array

Hi I am writing a small plug-in which I get some content from outside of WordPress and I want a small script to trigger whenever a new post, page or comment is added. Also if any Widgets, themes and ...
0
votes
1answer
284 views

Which are the hooks run before/after when a category's deletion?

What are the actions that a plugin can hook on to for processing when the user deletes a category?
0
votes
2answers
1k views

Are there action hooks for comments?

This is for a personal-use plugin I'm trying to make. I want to submit a comment from site A to my blog (sort of like sending trackbacks/pingbacks but a full comment). For instance, on site A I have ...
1
vote
2answers
314 views

How to track post number on the_loop

I have a need to customize some posts from the loop. Here's the deal: My site is set to 10 posts per page. On post #2,#5, #7 (on every page), I want to display specific background. What's the best ...
2
votes
1answer
3k views

add_action('wp_ajax_[action name]', myfunction) problem

I'm trying to integrate ajax in wordpress using the wp codex guidelines. In the PHP I added: wp_enqueue_script ( 'my_ajax', ADMIN_URL . 'js/ajax.js','jquery','1.0.0' ); wp_localize_script( 'my_ajax', ...
2
votes
1answer
72 views

How to run scripts when a new blog is created in Buddypress?

I'd like to insert some mysql data into every new blog that's created on my buddypress system. How can I hook up to the newly created blog data? ID, for example, would allow me to insert it right from ...
2
votes
1answer
304 views

Scheduled event won't fire

I'm trying to set up individual, one-time schedule events in a plugin. No matter what I do, I can't seem to get the events to fire. I'm using the Cron View plugin to see what's in queue, and the ...
2
votes
2answers
6k views

Use latest jQuery in WordPress (admin interface)

I want to use the latest jQuery (and jQuery UI) versions on my admin interface (editing a specific post type that I created). I tried this: // jQuery 1.x wp_register_script('jquery1x', ...