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

learn more… | top users | synonyms (2)

3
votes
2answers
436 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
1answer
421 views

Custom login modal page action

I have a modal login and I also have a custom login page as well. modal login page is mostly being used for login, register, forgot password. The problem is whenever you login by modal login page, ...
3
votes
1answer
72 views

Why is there both a save_post and wp_insert_post action?

I just realised that in wp-includes/post.php (source), at the end of wp_insert_post(), both the save_post and wp_insert_post actions are called one after the other, with the exact same parameters: ...
2
votes
1answer
684 views

WP Login forms action URLs displayed as pretty URLs in browser (ex with Restore Password)

I would like to use the WP native login/register/restore password/.. functionality, but display pretty URLs instead of wp-login.php I've been looking at the core code and noticed that most login ...
5
votes
2answers
259 views

Content hooks vs User hooks

This is more of a theory question than a question with a direct answer. I've been working with different actions for firing functions when a post is updated or deleted and when users are updated or ...
4
votes
1answer
38 views

Is there a global action for when a plugin is uninstalled?

I need to do something anytime any plugin is uninstalled. There's a hook for when MY plugin is uninstalled but I don't see an uninstall equivalent of deactivated_plugin. Does uninstalling a plugin ...
0
votes
1answer
27 views

Move jQuery on *top* of footer

I am using this code by Peter Wilson to move jQuery to footer: function pwcc_jquery_to_footer( &$wp_scripts ) { if ( is_admin() ) { return; } /* Move jQuery to the ...
0
votes
1answer
68 views

How to trigger function on theme delete?

Tried to find an or some hook to fire a function when theme is being delited, but didn't find any hook.. May be someone can tell if there's a way to fire my function on themes delete event? I need ...
2
votes
2answers
78 views

do_action and hook methods

I am trying to understand how hook methods work in WordPress. I understand that when do_action is called WP looks for all registered listeners and invokes them according to set priority. How does ...
2
votes
1answer
499 views

Restrict post edit/delete based on user ID and custom field

I've been able to prevent deletion and editing of posts based on user ID and page ID however, I need to restrict access to editing and deleting based on a custom field. Not sure how to go about doing ...
9
votes
9answers
3k 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 ...
1
vote
1answer
813 views

Using add_filter() in Widgets

Just have a query reference the add_filter() function. Can you use this function inside a WordPress widget class. Example I have a widget with dynamic created code that I want to pass to another ...
0
votes
1answer
922 views

Add content after get_header

I'd like to add content directly after the div#main (end of header.php) and before /div#main (beginning of footer.php). I'm using an own child-template (of twentythirteen), that contains only style....
0
votes
2answers
481 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. http://hitchhackerguide.com/2011/02/12/...
1
vote
2answers
630 views

wp_logout action not working

I'm trying to remove some cookies set to control persistent login when the user specifically wants to log out of a website. I thought it would be as simple as: function remove_user_cookie() { ...
0
votes
1answer
14 views

Add a filter to an action [closed]

I feel like this is a really simple question, but I can't seem to find anything. I want to add a filter to an action, so I can run preg_replace on it to add a class to a link. The action is: ...
0
votes
1answer
17 views

Custom comment action

I have updated my Wordpress version from 4.3.1 to 4.5.2 and apparently it broke a custom function I've made in the past. What it does: Display a anchor below comments, next to Approve/Answer/Edit/...
0
votes
2answers
45 views

Refresh page after form action

I've a listing post page where all posts are shown. On each post's row I can perform actions like delete, archive etc. So imagine that: I have an "archive" button; I push on it and I get a modal (...
0
votes
0answers
17 views

Init action and refresh page after form action

My problem is that I can't refresh the page after a form action into a loop. In my case I have a listing post page where I can delete, archive, deliver posts through a modal form, row by row. After ...
1
vote
1answer
26 views

return values from hooks do_action and apply_filters, which is better

Myself wondering among the following methods which is better to update an option value where value to be updated is coming from an ajax callback. Since Wordpress Codex clearly says apply_filters is ...
0
votes
0answers
18 views

How to Modify all of an action outputs

There's a plugin in my site that allows to introduce extra information with the following action call: do_action( 'bp_before_member_header_meta' ); Another plugin adds some of it with add_action: ...
0
votes
1answer
2k views

Action hook “wp_insert_post” works but not for last imported post

I want to run a custom function whenever posts are imported to my custom post type. I am currently running this code - function on_post_import($post){ global $wpdb; $results = $wpdb->...
2
votes
1answer
38 views

add_action customize_register not working

I've been working on this for a long time but can't get it fixed. I'm simply trying to get the function below to work but it's refusing to do that. I have put it in functions.php of my theme. ...
-1
votes
0answers
16 views

Dump new user data into codeigniter user's table

Here is the flow: Add new user from WordPress dashboard. Grab the newly registered user's data. dump user's data into codeigniter app database What i have tried: using user_register action hook ...
3
votes
4answers
11k 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
2answers
2k 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.
0
votes
1answer
995 views

get_term and get_term_by return null or false, even though term exists

I am trying to use the action hooks delete_term and delete_$taxonomy, among other hooks that delete a term, but they are presenting the same issue. For example, 1234 is an existing term in the ...
3
votes
1answer
703 views

Deactivate plugin for a specific user group

I would like to deactivate a plugin for a specific user. I'm using the following code inside a the wp-content/plugin-mu plugin file: add_filter( 'option_active_plugins', 'bo_disable_apm_plugin' ); ...
1
vote
1answer
38 views

How to filter content for specific content variable

I created a plugin that adds content from another post, and places this content next to the original content. I can say, that this content should appear at the bottom of the original post content. I ...
0
votes
1answer
532 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
27 views

Pass arguments to function class with do_action()

I'm trying to develop a "simple" script where i can create a filename with a timestamp of the last edit. For this I'm trying to code a class – but I'm having problems to pass an argument to add_action....
0
votes
1answer
46 views

Understanding and using did_action() in a conditional statement

I'm working with Genesis Framework in a custom theme, but this is not a question "genesis-specific". I need to populate the sidebar of my pages (not posts) conditionally. The condition is to check ...
1
vote
3answers
2k 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: add_action('...
1
vote
0answers
21 views

Wordpress form. Variables to display on other page? [closed]

I'm using Ninja Forms, and I'm working on a form where when the users presses "ok" then the page is supposed to go to another page which shows specific information and links for that user. Right now ...
1
vote
1answer
29 views

Insert term when page is published - avoid duplicates after edits

So i want to dynamically add terms to a custom taxonomy named after new pages when these are published. Problem I have is that when you edit the page titles, another term will be added to the taxonomy....
31
votes
3answers
13k views

remove_action or remove_filter with external classes?

In a situation where a plugin has encapsulated its methods within a class and then registered a filter or action against one of those methods, how do you remove the action or the filter if you no ...
0
votes
1answer
20 views

save_post not triggered when a post is updated

I'm encountering something weird. I made a function on functions.php that I want to trigger when a post is saved or updated. function gh_set_inner_project_order($post_id){ $parent_id = ...
0
votes
1answer
25 views

Remove action added through function

A theme I'm using modified a woocommerce that I'd like undo in my child theme. It's been added as shown: function theme_setup(){ remove_action( 'woocommerce_before_main_content', '...
0
votes
2answers
62 views

How to get a single hook from wp_head()?

I am working on a custom post type and I don't want it to get all the clutter from wp_head(). However, I do want to show a specific hook, for example the YoastSEO meta tags. How do I call a specific ...
3
votes
3answers
4k 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
0answers
60 views

Filters, priority when run after plugins_loaded

In my main plugin I filter the_content to add rich snippets. Something like this: add_filter('the_content', 'add_schema'); function add_schema( $content ) { $schema = NULL; //To avoid undefined ...
1
vote
1answer
39 views

Wait a result before enqueue

Supposing we have : class AwesomeClass{ private storedResult; private __construct(){ add_action( 'set_logged_in_cookie', array($this, 'a'),10,1); add_action('...
0
votes
1answer
23 views

previous_post_link inside of a function?

I'm missing something on how to call previous_post_link() inside of a function. I also tried assigning the output to a string variable and using that. function prevnext( $content ) { $content .= '...
0
votes
2answers
62 views

How to pass parameters to admin_notices?

So there is the following case. I need to display a name inside of admin_notices. class MyPlugin_Admin { public static function render_admin_notice() { echo $name . ' has been upgraded.';...
4
votes
1answer
154 views

How to do_action and get a return value?

So there is the following scenario. I add an action to clean logs from the database: add_action( 'myplugin_clean_logs', array( 'MyPlugin_Logs', 'clean_logs' ) ); Now I want to run this action ...
0
votes
0answers
19 views

Run javascript code after “woocommerce_payment_complete” action hook

I am trying to fire custom javascript code after successful payment in woocommerce. Code that I use so far: add_action( 'woocommerce_payment_complete','mysite_woocommerce_payment_complete' ); ...
1
vote
2answers
3k views

When is admin_init Action ran?

I have this function below that is called with the admin_init Action function my_flush_rewrites() { global $wp_rewrite; $wp_rewrite->flush_rules(); } Like this add_action('...
0
votes
1answer
48 views

Why doesn't a form need an 'action' with a plugin that uses the post data?

So I'm still rather new to WordPress plugins. And there's one thing that I'm not sure of. I'm building a front-end form that allows users to post posts. In this guide down below there's a plugin made ...
0
votes
1answer
22 views

I can't enqueue Suggest.js in frontend - not added

my suggest.js is not being added in front-end. All scripts are correctly loaded but this one. I want to load it only on frontpage so: add_action('wp_enqueue_scripts', 'homescripts'); function ...
17
votes
4answers
12k 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.