Tagged Questions
0
votes
1answer
20 views
Is there a author_update action?
Is there an action you can tie into whenever an authors information is updated. (ie they update their display name). If not is there any way to tie into this?
-1
votes
0answers
26 views
hooks of qTranslate
Is there any ways to find out all hooks of qTranslate? I am thinking to add an action when a user clicks a flag to change the language. I've checked the cord codes of qTranslate, and it seems that ...
1
vote
1answer
61 views
Empty Super Cache programmatically (with ACF action)
I regularly use Advanced Custom Fields to create awesome backend interfaces for my clients (as I'm sure a lot of us do…). ACF includes an Options add-on that creates one or multiple global options ...
1
vote
2answers
108 views
Trouble understanding apply_filters()
In apply_filters()
apply_filters( $tag, $value, $var ... );
I'm having trouble wrapping my head around the $value and $var. I read the codex and it sounds like the $value can be modified, $var not, ...
3
votes
1answer
54 views
Is there an action for when permalinks are rebuilt?
In my plugin, I have a list of titles and permalinks in the options table. It's updated every time my custom post type is saved.
Since I'm saving permalinks the option data can become bad if the ...
1
vote
2answers
69 views
Hook before inserting user into database
I'm working on airsoft website using woocommerce. One of my client's needs is to prevent a user to register if his name or mail is in a blacklist (I don't know yet if I'll use a csv file, a json or a ...
1
vote
0answers
27 views
Hooks are not being removed in child theme
I have a hook file:
function load_admin_package(){
do_action('load_admin_package');
}
/*
* -----------------------------------
* Define hooks bellow
* -----------------------------------
*/
...
0
votes
2answers
65 views
Action hook to control access to certain parts of my site
I'm searching for an action hook which I can use to control access to certain parts of my Wordpress site. I want to write some custom PHP which will check certain user attributes and decide if they ...
-1
votes
2answers
55 views
Hooks are not executing
Based on my understanding of hooks, you create a hook, by doing do_action('hook_name'); then add something to said hook and call the method where you want it to do the hook, so:
public function ...
1
vote
1answer
39 views
Create hooks based on an array of hook names?
I have this idea where I would create a class that would take in a set of hook names then create them, for me to use when ever, and where ever.
Currently the way to create a hook is we do something ...
2
votes
2answers
68 views
Action hook 'wp' firing twice… why?
I noticed that when I hook into 'wp' it seems to be firing twice -- for example
add_action('wp', 'just_testing');
function just_testing(){
global $post;
error_log($post->ID);
}
returns ...
0
votes
2answers
166 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 ...
0
votes
1answer
409 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 ...
0
votes
1answer
61 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
125 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 ...
1
vote
3answers
79 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
127 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
2answers
333 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 ...
-2
votes
1answer
88 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
187 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 ...
1
vote
1answer
60 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', ...
4
votes
2answers
90 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 ...
0
votes
1answer
164 views
What filter or action hook to use in order to load some code before the template begins printing in BuddyPress?
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 ...
0
votes
2answers
80 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 ...
0
votes
1answer
269 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 ...
1
vote
1answer
477 views
How to use filter hook 'post_updated_messages' in coherence with action hook 'save_post'
I am trying to send out e-mail, SMS and IM notifications to group members of this WordPress website, whenever a WordPress page in their user group has been published/updated.
I figured using the ...
0
votes
1answer
153 views
Create action running on trashed_post hook to modify post_meta value
I have a custom post type that always do math operation to its post_meta and other custom post type post_meta.
For example:
post-type 1 = cpt_product_order
post-type 1 post_meta = ...
0
votes
1answer
250 views
How to only hook on Single.php after content?
I am currently hooking on the_content() but that goes through the Wordpress loop too. How can I only hook on the Single.php page?
Also, is there a way to only look on the first X posts in the ...
0
votes
1answer
171 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?
1
vote
2answers
82 views
Too many actions/filters!
New to wordpress here. The concept of actions/filters in and of itself is not too difficult to grasp. What I am overwhelmed by is the HUGE amount of actions and filters available. When I am looking at ...
1
vote
1answer
114 views
Looking for a hook for post.php
First time posting here...
I am trying to figure out if there is a hook or action that I can use when a user goes to wp-admin/post.php... Basically when the user goes to post.php I want to check if ...
1
vote
1answer
181 views
Which action does wp_update_user triggers?
I am working modifying an ecommerce plugin, and it makes uses of wp_update_user() function, and everytime the function runs another table (created by the plugin), gets updated too. The problem is that ...
1
vote
3answers
268 views
Is there a recover_post hook to go with trash_post hook?
I'm using the trash_post hook to set a flag in a custom table to indicate that this item is "deleted", but when the user chooses to restore that post, what hook can I use for that? I couldn't find ...
0
votes
3answers
262 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);
...
2
votes
1answer
1k views
How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
How can I remove "Proudly powered by WordPress" from twentyeleven without modifying footer.php, and without creating a child theme?
I'm looking for a php command, such as add_action, remove_action, ...
1
vote
2answers
207 views
action lifecycle
I'm looking for a documentation page where wordpress action lifecycle is explained. Does it exist?
I can't understand if init is called before admin_head or viceversa (even if the name is ...
8
votes
1answer
1k views
Passing a parameter to filter and action functions
Is a way to pass my own parameters to the function in add_filter or add_action.
For example take a look in the following code:
function my_content($content, $my_param)
{
do something...
using ...
1
vote
1answer
973 views
Hook to get image filename when it is uploaded
I want to get the full local filename of an uploaded image so that I can copy it to a new directory and process it with my own image processing scripts. Which hooks/actions should I look into to ...
1
vote
2answers
121 views
how to determine how many and what kind of arguments are passed to hooks
I am not able to understand a very logic behind add_action / add_filter
Consider following example:
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', ...
2
votes
2answers
257 views
Run javascript code after wp_login hook?
after using the wp_login hook, is it possible to add a snippet of javascript code to the page seen immediately after the login in wordpress?
I want to use this top implement a notification system ...
0
votes
2answers
1k views
How can I edit post data before it is saved?
I have a plugin and I would like to be able to run the post content through some filters before it is saved to the database. From looking at the plugin api, I see that two hooks that look like they ...
0
votes
1answer
176 views
How can I override one post and make it display content for another post?
I have two pages on my Wordpress site:
mysite.com/?p=100
mysite.com/?p=200
I think I should be able to hook into Wordpress' actions somewhere and re-query the post, so that content for ...
3
votes
2answers
365 views
How can I log a user out of Wordpress before the page loads?
I would am using the code below so that on my wordpress site if ?logout is appended to the end of the URL the user will be logged out. This works well - if the user visits a page such as ...
0
votes
1answer
102 views
Change status of page after an event (Looking for best practice advice)
I'm looking for a best practice/ideas for modifying the status/data of a page after an event.
Here's an example of what I'm trying to accomplish - This WordPress site would allow users to sponsor ...
1
vote
1answer
572 views
How can I see all the actions attached to an “add_action” hook?
I'm working with the admin bar and trying to debug some of the menus and their priorities.
I know several callbacks get bound to actions, such as this one:
add_action( 'admin_bar_menu', ...
0
votes
1answer
48 views
Create categories on blog creation? [closed]
I hav ea wordpress network running, what I'd like to do is create a plugin which detects when a new blog is created in the network then automatically adds a set of predefined categories to the blog.
...
0
votes
1answer
419 views
Hook for page Request?
I want to run a function that looks at the current url params of the page that is requested and sets a cookie based on those params.
So, I guess I'm looking for:
The Wordpress Hook that allows me ...
-2
votes
3answers
102 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 ...
6
votes
2answers
3k views
Is there a hook that runs after a user logs in?
I am writing a plugin that fetches some extended user info from a remote service and I need it to execute its function each time a user logs in.
Is there a hook that gets fired after login that I can ...
1
vote
2answers
62 views
Same Conditionals Not Working on Two Different Hooks
Everyone!
I am new to WP and trying to build a plugin. I have the following codes working properly:
add_filter('the_content', 'say_hello');
function say_hello($content){
if(is_single() || ...