Hooks a function on to a specific action. Actions are (usually) triggered when the WordPress core calls do_action().
2
votes
2answers
543 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
0answers
8 views
BuddyPress: groups_group_create_complete action does not fire after creating a new group
The action hook groups_group_create_complete does not fire after I created a new group. What could be the problem?
5
votes
1answer
159 views
How to create an API for my plugin?
I have been developing plugins for WordPress. Most plugins I have developed with two three classes and not so huge like Buddypress, WooCommerce or etc.
I am planning to make two open source plugins ...
0
votes
1answer
31 views
How to do a task only once for logged in users
I want to do a task only once after an user has visited my site. I am currently doing like this:
function my_task(){
//do my tasks
}
add_action('init', 'my_task');
I am doing this from a ...
0
votes
1answer
166 views
Redirect back to origin page after using get_delete_post_link()
I need to implement frontend and backend redirection after delete specific post using get_delete_post_link(). Which hook i can use? Any advice would be appreciated.
Something similar to :
<?php ...
1
vote
2answers
29 views
Replace a word with a word in the URL string
I'm trying to replace a word on every page for example "Denver" with a word from a URL string, so I'll have like ?city=Atlanta in the URL. So I was thinking of using PHP's GET to just get the city ...
0
votes
0answers
32 views
How to add X number of products to woocommerce cart at once
I am trying to add x number of products input and button to my catalog page so I can select a number, then hit add to cart.
Is it possible to add in this function? The user will provide a number ...
0
votes
2answers
614 views
How to append new form elements in “Add New” form of Users in Wordpress admin panel?
I'm developing a WordPress plugin and I want to append some extra form fields in add new form of Users section inside admin panel without editing core files. Can somebody help me in achieving this.
2
votes
1answer
184 views
How to modify wp_ajax function?
I want to modify wp_ajax_find_posts function. It receives search string from find-posts form and delivers search results by ajax. Part of the function looks like this:
function wp_ajax_find_posts() {
...
0
votes
2answers
227 views
How to get post ID with hooks publish_post, new_to_publish, etc
I have two plugins, one uses the function wp_insert_post(), the other has a code like this:
add_action('future_to_publish', 'myFunc', 10, 1);
add_action('new_to_publish', 'myFunc', 10, 1);
...
0
votes
1answer
116 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
28 views
How to show a users bio on a page
I'm fairly new to Wordpress. I have users that create profiles on my site and one of the sections is their bio. How can I take this information and display it on lets say a "users profile page".
...
1
vote
3answers
272 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
47 views
Using several add_action with parameters inside a class
I'm creating a theme framework and using a class to initiate all basic function of the theme (adding theme support, menus, etc). I've got stuck when I tried to enqueue the scripts and styles though:
...
0
votes
2answers
25 views
Problem with executing a function on saving a post
Here is my basic plugin code. I am just starting from scratch. I will explain the functionality. It is simple, While my plugin is active it will add a new meta box in add new post page just below the ...
1
vote
0answers
58 views
Filter list by a unique meta value dilemma
I'm been racking my head at this for a while now, and I can't figure out how to fix the code.
Here's the issue;
I found a snippet of code online to filter my post results in edit.php based on ...
-1
votes
1answer
25 views
What do the numbers mean at the end of add_action('save_post')…?
I've seen on a few tutorials that there are numbers at the end of the call to save Custom Fields/Meta Boxes on the save_post hook. For example, in the WordPress Codex it gives the following example:
...
0
votes
1answer
585 views
Custom post_type search's $wp_query->query_vars do not correspond
I have been having this issue, with integrating events manager among my other post types, where the other custom post types show up in the $wp_query->query_vars array, except for the event manager ...
2
votes
3answers
3k views
add_action with a class method is causing fatal errors
I wasn't sure if this was a PHP issue (suited for StackOverflow) or a WordPress issue (suited for StackExchange), however since my issue appears to be with the add_action() function, I have placed the ...
0
votes
1answer
22 views
Is there an action for save_menu and/or update_menu?
I want to "save" my menus into transients. I want to update those when there's been any changes to the menus via the admin custom menus. I've looked for an action but can't see to find anything. ...
0
votes
1answer
49 views
add_action on a specific page
I found this script Wordpress Media Manager 3.5 - default link to
and it works fine for me. But my problem is, that I have a custom wp_editor on the front end where I want it to work, but I can't ...
0
votes
0answers
36 views
do_action in index.php and add_action in functions.php not displaying anything [closed]
I'm trying to display in my index.php a div created by a add_function in my functions.php
So in my functions.php I have:
function display_special_banner(){
echo '<div>Ciao</div>';
}
...
1
vote
1answer
80 views
Why are you using add_action for shortcode?
I would like to create shortcodes, some tutorials write about to use add_action
add_action( 'init', 'register_shortcodes');
but I read tutorials where the author didn't use it, only put
...
1
vote
2answers
56 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: ...
0
votes
2answers
51 views
Display Something in the Header After All Styles are Loaded
I'd like to include a functionality in a theme that will overwrite styles from previously included CSS files. For this purpose, I need to be able to display a <style> in the header after ALL ...
1
vote
1answer
51 views
Detect type of post status transition
I have a function on my site that it supposed to run when a new post is published (email push notification), with the exception of the same article updated (i.e publish_to_publish transition, I don't ...
0
votes
1answer
33 views
How to get current action?
I am developing custom registration form. Is it possible to get current action (comment adding or user registration) in function? For example i am using:
add_filter('preprocess_comment', ...
1
vote
2answers
92 views
remove_action in a theme
I'm using a theme that gets updated pretty frequently. For this, it has added a custom.php file to include modifications. Now, in this theme, under the functions.php, the developer has included his ...
1
vote
0answers
47 views
add_action on inherit post status
I'm trying to use the add_action() hook to run a custom function, but am struggling with the post status.
I originally tried using:
add_action('pending_to_publish_portfolio', 'my_function');
...
-1
votes
1answer
512 views
WooCommerce Order Status Displays Twice on Order Page
I modified the woocommerce_custom_order_columns function to make some changes to the WooCommerce Admin Order page. Everything works great, except that Order Status shows up twice (but only for the ...
0
votes
0answers
22 views
How to pass CLASS function with arguments to add_action? [duplicate]
Possible Duplicate:
Passing a parameter to filter and action functions
This works:
add_action('hook', array($this, 'someFunction'))
These not:
add_action('hook', array($this, ...
0
votes
1answer
77 views
Would there be anything stopping me from removing both wp_head and wp_footer?
Some plugins rely on either wp_head or wp_footer or both to introduce their own stylesheets and JavaScript. Those scripts take time to load and slow down my website. Therefore, I would like manually ...
3
votes
2answers
77 views
How do I use add_action from a class method?
For some context, we're building an activation system for new users of an app using WordPress as a framework. We've got a plugin driving most of our interactions, where all of this code resides.
When ...
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
...
2
votes
1answer
43 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
1answer
79 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
77 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
71 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
121 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
148 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 ...
2
votes
1answer
262 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
1answer
94 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
83 views
Plugin that generates a page of post content
My script is generating a duplicate post even after I explicitly state that the post_type should be a page. It also ignores the $post_title, which I do not want to create a duplicate post if the title ...
0
votes
2answers
414 views
update_user_meta not updating
I'm trying to force password change upon first user login, which overall is not working, but so far I find a problem update_user_meta() is not updating at all, this is my code:
function ...
2
votes
1answer
48 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');
3
votes
2answers
55 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
35 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
134 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
48 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 ...
2
votes
1answer
143 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 ...


