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

learn more… | top users | synonyms (2)

1
vote
2answers
140 views

admin-ajax.php “ Missing argument 2” warning

I have the following code in functions.php <script type="text/javascript"> var post_id = "1055"; // hardcoded post id for testing purposes var type = "some_type"; var data = {action: ...
3
votes
1answer
138 views

Perform action on WPMU blog deletion

Hi guys :) I know there is the wpmu_new_blog action hook which enables us to perform an action when a new WPMU blog is created. Is there something similar to this which enables us to perform an action ...
0
votes
2answers
375 views

WordPress Ajax Problems

Update I got it to fire using the following curl command: curl -H "Accept: application/json" -X POST http://localhost/wordpress/wp-admin/admin-ajax.php -d ...
1
vote
1answer
474 views

How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?

Info about wp_die from codex: Kill WordPress execution and display HTML message with error message. A call to this function complements the die() PHP function. The difference is that HTML will be ...
0
votes
1answer
122 views

where does my function output from load-* go?

I've got a function hooked into load-edit.php that prints out print content: add_action('load-edit.php', array($this, 'generate_bulk_print_content')); public function generate_bulk_print_content() { ...
1
vote
1answer
179 views

Implement Hooks Using Array

I'm trying to implement some hooks into a theme, but rather than write out every hook with repetitive code I was wondering if I could use and array to declare the hooks instead. E.g. ordinarily i'd ...
1
vote
1answer
207 views

Action hook load_textdomain $domain variable

I use the load_textdomain action hook to list all active localization text domains with corresponding path to translation files. function mo_location( $domain, $mofile ) { if ( ...
0
votes
1answer
689 views

Where is the best place to use add_filter

Should I use the function add_filter In my plugin's init action hook or just the in the main plugin script? Since sometimes I found people is using filter all over the place and if I put in the init ...
3
votes
1answer
1k views

Trigger custom action when setting button pressed

This is my first wordpress plugin and I'm running a lot of trouble making it work, it almost work fine but I don't find a way to accomplish this specific thing. Basically I've my custom setting page ...
1
vote
2answers
351 views

Convert hyphen to underscore in permalinks

I would like to use underscore in my permalinks instead of hyphen. Current permalink: www.example.com/2013/01/hello-this-is-a-test-post/ Desired permalink ...
0
votes
1answer
290 views

how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?

How add_action("manage_posts_custom_column", "custom_callback_fun01"); relate to add_filter("manage_{xxxx-xxx}_columns", "cusotm_callback_fun02" );? How do they both work together? By using these ...
2
votes
2answers
62 views

Is there an action that is called when a post is restored from the trash?

I'm looking at the wordpress list of actions and trying to find an action that is called when a post is restored from the trash but cannot find one. Does anyone know if it exists?
0
votes
1answer
1k views

Disable WooCommerce action

I'm customizing a WooCommerce theme and am going to be moving the title. There is an action in content-single-product.php called do_action( 'woocommerce_single_product_summary' ); in the ...
-1
votes
2answers
95 views

Fix incorrect related posts code snippet

Can anybody fix this incorrect related posts codes snippet? function related_posts() { if (is_single()) { global $post; $current_post = $post->ID; $categories = get_the_category(); ...
2
votes
1answer
106 views

Is it possible to use object in add_action?

So is it possible to do something like this with add_action? class class{} $my_class = new class; add_action('init', 'my_class');
0
votes
1answer
1k 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 ...
3
votes
2answers
84 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
1answer
315 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
86 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 ...
1
vote
1answer
200 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 ...
0
votes
3answers
67 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
52 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 ...
0
votes
2answers
1k views

wp_list_tables bulk actions

How to fire on bulk actions inside of an extended WP_List_Table. I have been adding the following bulk actions to may table's select box but on Apply won't really happens anything here are how I ...
0
votes
1answer
93 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
3answers
2k views

Custom post type save_post action not firing

Sorry if this is already answered on here. I looked around and couldn't see any answers to my question so I thought I'd post my own. I'm building a plugin for a client that gathers customer feedback ...
1
vote
1answer
231 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
458 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
54 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 ...
7
votes
3answers
997 views

Remove an action from an external Class

I'm trying to do something similar to this question here: remove_action or remove_filter with external classes? I'm trying to remove the <!-- This site is optimized with the Yoast WordPress ...
0
votes
2answers
271 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
199 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
151 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
88 views

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

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
96 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
221 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
716 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
97 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 ...
2
votes
2answers
911 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
282 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
106 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
95 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
405 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
169 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
66 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
372 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
169 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
32 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
564 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
106 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 ...
0
votes
1answer
476 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 ...