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

learn more… | top users | synonyms (2)

0
votes
0answers
6 views

do action inside a class is not working

I am trying to create my custom hook and call it from within a metabox class. Here is the pattern: metabox.php -- <?php require("libs.php"); require("test.php"); class metabox() { function ...
0
votes
1answer
449 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 ...
1
vote
1answer
21 views

When can you get current page ID and initialize hooks right after?

I'm developing a plugin and need to know on what page user is and then add specific hooks and filters for that page. And my problem is that is_page() and the_ID() doesn't work outside of wp, ...
0
votes
2answers
2k views

Deregister scripts on unnecessary pages using remove_action

To all would-be close-voters: This question is not a duplicate, because I need to remove all scripts added by plugin using remove_action. In Very stubborn wp_register_script / add_action vs ...
0
votes
2answers
631 views

How to hook into the quick edit action?

I found this solution to automatically assign parent terms when a child term is selected, which is working fine for the save_post hook: add_action('save_post', 'assign_parent_terms'); function ...
0
votes
1answer
56 views

Exists filter or action that change Add New Post link?

I want to know if exists some method from filters or actions to change the link of the Add New button in backend , for example the regular url is http://wordpress_install/wp-admin/post-new.php but I ...
0
votes
1answer
14 views

Action hook with wrapper html

I want to add a space for a banner across the top of my WooCommerce Category pages, but i'm trying to figure out how to add some markup that will wrap the action. In my archive-product.php I have the ...
0
votes
1answer
35 views

How can I edit comment meta value before it is saved?

I have introduced a custom field in comments form using add_comment_meta() function. I would like to know if there is a way to edit the data of the comment meta just before the post data is saved so ...
3
votes
2answers
381 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

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
13 views

WordPress save_post hook not firing when checking if _GET['post'] is set

I was facing an issue (a custom metabox not saving), and after 2 hours I finally realised that, if you try to add an action to the save_post hook inside an if statement checking whether $_GET['post'] ...
1
vote
1answer
596 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
0answers
5 views

Catalog/Archive page products and adding weight choice per product-all items are added to cart

I am using the following code to create a choice of quantity on my catalog/archive page with over 40 products. It looks close to what I try to achieve. Unfortunately, when I change 1 item, the cart ...
0
votes
1answer
1k 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 = ...
0
votes
1answer
813 views

wp_trash_post action hook with custom post type

When a 'contact' cpt post is trashed, i need a metakey from another cpt 'act' to be deleted, i have been searching all over which hook i should use but unfortunatly the codex action reference page is ...
0
votes
1answer
119 views

AJAX login without a plugin does not work. when add a action to function.php

I am using wordpress ajax login without a plugin. I want to not be allowed users access to the WordPress profile after login, Because i have designed a specific profile in the link: ...
1
vote
1answer
378 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 ...
0
votes
3answers
1k views

How do I add some javascript validation to the admin interface form's onsubmit?

I have a plugin that adds meta boxes to the admin interface and I need to do some validation when the user presses the "update" button before the form is submitted. Is there a WordPress action or ...
0
votes
0answers
13 views

wp_schedule_event doesn't work

Can someone tell me where I'm going wrong? Images in folder /wp-content/cached_img/ are not delated add_filter( 'cron_schedules', 'cron_add_week4' ); function cron_add_week4( $schedules ) { ...
0
votes
1answer
26 views

get_header and hook avoid normal call

I would like to use a custom header, like get_header('new') But I cannot modify the templates easily where the calls are being made due to several reasons. (many files and same code base deployed on ...
0
votes
1answer
654 views

Insert new user with form submit 'init' hook

I'm posting a form to insert a new user and hooking my function to 'init'. This code is in my mu-plugins folder. The user gets inserted fine, but the page is not loaded after wards. My form action ...
6
votes
2answers
261 views

How to validate XML-RPC post creation and cancel when needed?

I have an IFTTT recipe that creates posts for me on some occasion, but for some weird reason it creates three, sometimes four posts of the same content. I would like to add an add_action ...
9
votes
2answers
9k 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
1answer
14 views

What's hook to use immediately after a user is authentcated

Does anyone know the add_action() hook to use immediately after a user is successfully authenticated. Hook Test based on @mmm's answer I ran this test from my mu-plugins.php file: function ...
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.
2
votes
1answer
585 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 ...
0
votes
0answers
22 views

Are immediately-called actions not usable in themes?

If there is a filter or action called immediately in a plugin file (not on 'init' or 'wp' action etc.), is it at all possible for a theme to filter it? Looking through wp-setting.php I would assume ...
0
votes
1answer
627 views

get_term and get_term_by returning null or false eventhough the term exists

I am trying to use the action hook delete_term, 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 favorite ...
7
votes
1answer
2k views

get a list of all registered actions

I'm trying to debug a plugin which I didn't develop and I want to list all the registered actions. I've read this SO thread: WordPress: How do I get all the registered functions for 'the_content' ...
6
votes
3answers
1k views

remove_action on after_setup_theme not working from child theme

I am trying to remove a theme action for an elegant-themes theme using a child theme.. This works when I remove action after add_action code anywhere in the parent theme functions.php. However, it ...
0
votes
3answers
35 views

Dealing with html forms [closed]

I want to work with html form but i cant understand the Action method and when we need to use it. For example found this code on w3schools: <form action="action_page.php"> First ...
1
vote
1answer
49 views

action not working

Im working on a site where I need one plugin to trigger another. So When a user checks out from woo commerce with a coupon, add that user to a group. We are using The free Groups plugin. ...
0
votes
1answer
47 views

What hook to add at start of WordPress load

I want to add a hook that is the first thing that runs every and any time someone hits a page, post or other WP piece of content on my site, and before anything else in WordPress executes. Can you ...
0
votes
0answers
8 views

Hooking into action that fires in wp_head from widget on front end [duplicate]

I have a custom action hook for which the do_action() is executed in a function that hooks into the wp_head action. I would like to run add_action() for that custom action hook from the front-end ...
0
votes
1answer
208 views

GET form action. Redirect to self

I'm writing filter for posts by category on author page. I send category name in $_GET array in this form: <form action="" accept-charset="UTF-8" method="get" id="form1"> <select ...
0
votes
1answer
55 views

plugins_loaded action is not working properly

I am trying to send an email to the user after form submission but I get an errorCall to undefined function wp_mail() in C:\xampp\htdocs\wordpress\wp-content\plugins\contact ...
6
votes
1answer
4k views

What is the very earliest action hook you can call?

After the solution to this question was to get a function to launch BEFORE the init action is fired by taking the sequence out of its function, it got me thinking, is there any earlier in the WP load ...
0
votes
2answers
140 views

Is it possible to track down Actions and Filters?

As far as I know using Actions and Filters hooks is the best approach for developing on WordPress. I have just to ask if there is any way to track down which Actions and Filters are applied on ...
4
votes
3answers
2k views

How can I find out what functions are assigned to actions?

Is there any way to know what functions are added to actions on a certain page in WordPress?
1
vote
1answer
279 views

Filter or action hook to insert content on admin pages before </body> tag

I am developing an administrator plugin and want to be able to write some HTML content just before the last body tag . This content will initially be hidden then displayed with javascript when a user ...
0
votes
1answer
95 views

How to hook into action/filter call

I'm about to create a very simple logging plugin. Every time an action or filter is fired I need to log it to the file. The idea is that we will be able to see exactly which actions and filters are ...
9
votes
3answers
8k 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.
0
votes
1answer
25 views

Reloading page with a query string upon login for admins

After users with specific roles log in, I would like to reload the current page with a query string added (to trigger a message via JavaScript). How can this be improved? function ...
0
votes
1answer
43 views

passing variables inside a widget add_action

Here's my code inside a widget class: function widget($args, $instance) { add_action('wp_footer', function () { echo $instance['title'] }); } It doesn't output $instance['title']. I tried passing ...
7
votes
5answers
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 ...
9
votes
3answers
3k views

How to get WordPress' hook run sequence?

What is WordPress' hooks execution sequence? I mean, I want to know the order, how add_action hooks are executed, i.e. init wp_head wp_footer after_theme_setup and etc.. I want to know the ...
11
votes
1answer
7k 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!
-1
votes
1answer
135 views

Generate payment URL in custom email [closed]

When a particular order status is triggered, a custom email is sent to the shopper. I would like to include a link in the email for them to pay for the order. From my current understanding, the ...
1
vote
1answer
33 views

Are there actions or filters I can use for Ajax calls?

I'm interested in writing a caching function for Ajax calls. If a third party plugin does their thing, calls wp_ajax_whatever, how do I pick that off? If a person does slideshow updates with a ...
2
votes
2answers
121 views

How to know what priority to use with add_action()?

I was writing a small plugin to remove some menu items for non-admin users from the backend, and discovered that my plugin didn't do anything unless I specified a priority in my code: ...