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

learn more… | top users | synonyms (2)

0
votes
0answers
11 views

What Will Happen If I do This Hook-ing Pattern?

I am creating a custom hook inside a shortcode like this: do_action("my_custom_hook", $param_1, $param_2, $param_3); I then creating a file containing a class and hooks like the following: class ...
0
votes
1answer
605 views

Automatically add attributes to woocommerce product?

I'm trying to make WooCommerce automatically add some attributes to a product when it's created. I'm trying to find the right hook to start with, so far the only one that seems correct is ...
0
votes
1answer
106 views

Use add_action within template

I have the following in functions.php. Is it possible to load them only on certain custom post types? (I have a few custom post types which all use a certain template part -> would it be possible to ...
0
votes
0answers
51 views

Execute function after creating new custom post type

I have a function: function add_editor_styles() { global $post; $post_type = get_post_type(); $editor_style = get_template_directory_uri(). '/css/editor-style-' . $post_type . '.css'; ...
0
votes
0answers
20 views

Why is wp_set_comment_status not firing and executing my function?

I would like to send an email to all users on a WordPress blog that are registered and have a specific user custom field set. This email should be sent whenever a new comment is published. Here is ...
0
votes
2answers
104 views

add_action to wp_head is added, but not called

I'm using the CiviCRM plugin for WordPress, and in the plugin's main file, civicrm.php, it calls add_action() to add a function to wp_head() in order to merge CiviCRM's header with my theme's header: ...
0
votes
1answer
29 views

Scripts not loading when using the wp_enqueue_scripts action

Really basic, I'm afraid. My scripts aren't loading when I put them as part of a function triggered by the wp_enqueue_scripts action in functions.php. If I put them outside of that action as part of ...
0
votes
0answers
49 views

Quick Edit And Edit Actions

I'm using this code. lastpostdate is my function in project. add_action('save_post', 'lastpostdate'); It's working in mysite/wp-admin/post.php but not working in mysite/wp-admin/edit.php with quick ...
0
votes
0answers
31 views

Adapting functions from Genesis theme

I am trying to adapt a tutorial based on the Genesis theme to the Bones starter theme, but am battling with the following functions: add_action( 'genesis_entry_header', 'tsm_do_acf_form_edit_toggle', ...
1
vote
2answers
50 views

Don't delete a page if it holds users

I have to do something but I just can't come up with a way to do it. On one hand I have created pages who are companies. So every page is a company-page. On the other hand I have created users who ...
2
votes
1answer
268 views

what's the usage of action do_meta_boxes?

/** * Fires after meta boxes have been added. * * Fires once for each of the default meta box contexts: normal, advanced, and side. * * @since 3.0.0 * * @param string $post_type Post type of ...
0
votes
2answers
99 views

How to trace SUBMIT button

I have a form that I created using a plugin which upon clicking the Submit button, it's redirecting to a URL that I selected in the form's settings. But the problem is that any other form that I ...
0
votes
0answers
37 views

Event fired when file attached to a post?

I am using a Plugin called Attachments which allows you to attach any number of files which each have there own defines meta data into a post. Adding new files uses the WP Media Library shown below. ...
0
votes
0answers
38 views

action callback, for action dispatched as reported by hook sniffer, not called

I installed the plugin https://wordpress.org/plugins/hook-sniffer/. Action Event Firing Order: Array ( [muplugins_loaded] => 1 ... [the_post] => 3 ... ) ... yet function ...
0
votes
0answers
48 views

How to trigger function on theme delete?

Tryed to find action or some hook to fire a function when theme is being delited, but didn't found any hook.. May be someone can tell if there's a way to fire my function on themes delete event ? I ...
0
votes
1answer
142 views

add_action in a custom plugin

I did a plugin to create a when the cookie is FALSE. Actually, the was working, but when I was about to create the cookie, it said that my header was already sent. Then, I had the code ...
0
votes
0answers
56 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 ...
2
votes
1answer
358 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
1answer
20 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
80 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 ...
0
votes
1answer
42 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'] ...
0
votes
0answers
33 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
0answers
41 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 ) { ...
1
vote
1answer
84 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 ...
1
vote
1answer
30 views

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

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
0answers
28 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
3answers
40 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
54 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
66 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
395 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 ...
0
votes
1answer
48 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
132 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 ...
2
votes
2answers
2k 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: ...
1
vote
1answer
83 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 ...
-1
votes
1answer
587 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 ...
0
votes
1answer
42 views

Cannot Schedule Sending An Email

I have a function that takes 4 parameters to send an email, and it works if I plainly call the function, but doesn't work when I try to call it from schedule_single_event. Here is the code: function ...
0
votes
2answers
168 views

My add_action (wp_footer, 'method') is not calling?

In my themes functions.php file I have put: add_action('wp_footer', 'method'); function method() { echo "this is being called"; die(); } My wordpress footer.php file looks like this: <?php ...
0
votes
0answers
18 views

How to load individual widgets within sidebar(Not all at once)

I want to load my Wordpress site sidebar widgets when scroll down. So I want to know how to load individual widgets one by one. I tried plugins like 'Lazy Widget Loader'. But they didn't work for me. ...
0
votes
1answer
200 views

Shortcode display outside the div

I have created a shortcode that retrives and displays a form.The content of the attribute in HTML. function check_my_login( $atts) { return '<form action="" name="" method="post" ...
1
vote
1answer
51 views

How to replace a function using a child theme?

I have the following function where I would like to replace the image nopic.jpg I have updated by deleting some redundant options. if ( ! function_exists( 'TaskerDev_get_first_post_image_fnc' ) ...
0
votes
2answers
102 views

Difference b/w Simple function call & do_action call

dear I unable to understand of simple function call & do_action function call. do_action: I hook function and I place this in my one template file for use in header template. ...
0
votes
1answer
81 views

How to intercept publish post for a custom post type “event”

I am trying to write a plugin that copies a custom post type "event" from one blog to another. The code for copying I already have working but I cannot seem to get this "add_action" hook to work when ...
0
votes
0answers
47 views

Hook on Publishing a Post Doesn't Fire Correctly (or so I think)

Currently, I'm trying to send out a Push Notification to iPhone every time a blog post is published on my WordPress website. I am using a PHP script to send out the push notification (which works with ...
1
vote
2answers
513 views

How to set a different value in the generator meta tag?

I know that you can remove the following line from the WordPress source code: <meta name="generator" content="WordPress 4.2.2" /> But instead of removing the tag completely, I just want to ...
0
votes
0answers
128 views

How to edit the response header of a post/page?

I am rendering a post/page differently. Instead of displaying an HTML document, I am making the page render a javascript code. The default content type of a wordpress post/page is text/html, is there ...
0
votes
1answer
161 views

Filter wp_dropdown_categories Per Post Type

I'm using wp_dropdown_categories to add a categories filter to the media library. It works fine, except it displays all the categories that are assigned to posts, but I would like it to only display ...
0
votes
1answer
41 views

How passing values ​​to construct function with Actions?

Must use a do_action (); to pass values ​​to my class. How do I do that?? add_action( 'plugins_loaded', array( 'someClassy', 'init' )); class someClassy { public static function init() { ...
0
votes
2answers
67 views

How can I set a dynamic value for post_updated_messages based on return value of post_updated?

I'm familiar with how to set custom messages for post updates using the post_updated_messages action hook. This question is slightly different. I have a function/action hook on post_updated: ...
0
votes
1answer
63 views

remove parrent theme action in child

I'm create Child theme from Storefront now i want to remove these action in child theme add_action( 'woocommerce_before_shop_loop','storefront_sorting_wrapper',9 ); by this function: add_action( ...