hooks's questions - English 1answer

1.526 hooks questions.

<?php function default_menu() { <form action="options.php" method="post"> <?php settings_fields( 'sample_check' );?> <input type="checkbox" name="sample" value="nofollow"/> </...

The form is in post creating window. Ajax is posting values, but the values doenst renews. Where can be problem ? Ajax <script> function dynamic_Select(field, aid, value) { console.log(...

In my plugin, I am doing a minimum-supported PHP version compatibility check via a function bound to register_activation_hook and halting activation for those on PHP version less than the minimum ...

I've found init and init_admin. Are there any action that executes just in the frontend? Thanks.

I'm using the following code to create a custom metabox on a custom taxonomy page. $term_filter_name_edit = $type . '_edit_form_fields'; add_action($term_filter_name_edit, 'box_term', 1000, 1 ); ...

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 = ...

I need to hook after file uploaded to server, get the file path, and then prevent WordPress from saving the attachment post. I found this filter add_filter('attachment_fields_to_save', '...

I am developing a e-commerce theme that requires an order page. I created a php file inside my theme folder named order-page.php and hope to access this page from the wordpress root url (example.com/...

I want to get the menu location in the wp_update_nav_menu (during menu save action) add_action('wp_update_nav_menu', function ($id, $data = NULL) { error_log( var_export($data, true) ); ...

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 ...

I'm using DevinVinson/WordPress-Plugin-Boilerplate as the base of the plugin, I already created a custom post type as book and a taxonomy linked to it as rack. What I need is to limit the number of ...

I'm trying to create a remove action for the woocommerce points and rewards plugin but I cannot get it to work. I haven't tried to remove an action that's like this before so any help would be ...

I'm working on my first plugin and I have made a nice settings page which saves and works. But I have split it to few files and now I can't determine if field is checked.. I have also tried ...

Im currently looking for a solution to make an "above-the-fold" inline stylesheet inside my header. But the clue is, to have it get its content from a .css file that was rendered from SCSS. So in ...

I'm using register_activation_hook to register a user role on my site, and It works. Now I want to edit the role of the user, I tried to reactivate the plugin and clear the cache and still not ...

I need to display a script just after all my js files loaded via wp_enqueue_script In my functions.php : function list_hotels($hotels){ ?> <script> var positions = []; ...

I have no idea what is wrong here. First I would like to share probably all required info. Plugin tree: $ tree . ├── classes │   ├── database │   │   ├── plugin-auth.php │   │   ├── plugin-user.php │...

I'm working on free theme and start learning how to customize that theme. my question is how to duplicate a section and control in a page? I tried that by duplicate add section, add setting and add ...

I have an interesting little challenge that I hope someone can help with. I have started to use WooCommerce Subscriptions. One of the products I sell is a membership, with monthly recurring payments. ...

I'm finding the way to add a hook to my woo commerce check out page (http://localhost/checkout) I'm tend to send cart items and billing address, user information to another page such as http://...

I'm using the plugin homepage control in many projects and really like what it does. I can create custom sections for my static homepage and can sort them in the customizer. In my recent client ...

I have a custom filter called user type in the admin user dashboard and I have already worked it out to display them in the user admin dashboard. But I don't know how to call and save them in an array ...

My title filter appends the string length to the changed title. Why is it doing this? How can I remove it? My goal: Change the header title only in the header section. My filter: function ...

Specifically, is it valid to run a new WP_Query() during the plugins_loaded action?

Is there a possibility to disable the email field on WooCommerce customer account details? Or Is there a hook or action available to do such thing? I'm just using a pre-made themes and not that much ...

Someone helped me on another StackExchange ticket regarding 301 RewriteRules and gave me 2 methods based on WP hooks as below add_filter( 'post_rewrite_rules', function ( $rules ) { global $...

I'm developing a WordPress theme with several templates. One template is called "Tabs". If a page with this template assigned has children pages, parts of their contents are shown in tabs on the ...

I wanted to add the action hook below only if we are not in a specific product ID. So i tried something like this in my functions.php global $product; $productId = $product->get_id(); if ($...

I want to modularly disable emails sent out by WordPress so I can replace them with my own custom emails when necessary. I tried googling for a list of filter hooks, but couldn't find anything as ...

Its been 3 days now I am fighting to resolve the issue here: An action hook where a comment meta is updated I am pretty sure, even if I am a beginner, that the hook update_comment_meta doesnt exist,...

I have an front-end ajax login on my site. I want to set the redirect url to '/services/clientarea'; for every page that is not part of the blog. For blog pages i want the login redirect to be $...

i'm trying to make custom ajax handler because the admin-ajax.php is taking to long to handle ajax requests from 7s to 10s so i google it and mange to do some custom ajax-handler.php like this <?...

I am trying to use a simple publish_post / publish_page hook to get the URL of the post/page when it is either published or updated so I can later turn it into a static page. Is it possible to add ...

I am trying to create a hook that when a user login, it check the user role.. if the user role is jsa_contributor then it redirect into specific page. but it seems my code didn't work. This is the ...

Is it possible to automatically add for example image before first h2 tag in the_content?

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' ...

Anybody knows if there's a hook before execution of a search query (not in main loop) in order to change the 's' parameter to avoid Wordpress' phrase splitting? Examples are welcome... thanks P.S.: ...

I want to display different titles in category archives than the category title. I have created a function with if statements for this purpose: function category_titles_change() { if (...

i have sample wordpress plugin class. Im hooking woocommerce woocommerce_saved_order_items and i want create a admin notice. Add action from __construct works, but when i want create a notice in hook ...

I am trying to redirect the user after form submission using wp_redirect() but it it is not working. I am submitting data using init action hook. here is the code. function ...

I am customizing WordPress behavior by adding filters. In my plugins.php file I have: add_filter ( 'wp_update_attachment_metadata', array ( $post_asset_uploader, 'handlePostAssetUpload' ),...

What I want is to get the output of the Twitter oEmbed system into my actual posts. IMHO the embed output itself is high-quality, semantic HTML and I'd rather have it inside the post than in the embed ...

I want to track when a certain piece of user meta is changed in the admin, and then perform an action. I thought I found the correct hook for it (from https://codex.wordpress.org/Plugin_API/...

I am trying to detect when a user changes their name. I have tried using the profile_update hook: add_action( 'profile_update', 'my_profile_update', 10, 2 ); function my_profile_update( $user_id, $...

I'm passing successfully an ajax object to the backend following this (the script in the JS really it does not matters because I'm getting it well): add_action( 'wp_ajax_my_action', '...

This question might be wrong, I am not sure about it. Because I am not clear on this. I know add_action it is used to to hook our function to the specified function. For example add_action('wp_head'.'...

I need for a specific plugin to override the wordpress function get_avatar() to bind the profile image to an other image with some condition. How can I do this ? Is there a specific hook or filter to ...

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 ...

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 ...

In a theme I am working there are up to 3 Stylesheets. I am using the hook 'wp_enqueue_scripts'. The order of the stylesheets is important for overwriting styles. I have a code like this: add_action('...

Related tags

Hot questions

Language

Popular Tags