Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

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
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 ...
2
votes
3answers
292 views

Implementing DNS Prefetching with WordPress

I'm not sure whether my question sounds promising or not but what I'm going to ask is very much relevant. So please read the full question before down voting or flag. I'm trying to implement DNS ...
0
votes
1answer
9 views

New User ID not working in custom function with user_register hook

I'm adding data to a table whenever a new user registers on the site. add_action( 'user_register', 'auto_follow_admin', 10, 1 ); function auto_follow_admin() { global $wpdb; ...
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 ...
0
votes
1answer
1k views

Trying to alter the post_content through the_post

I'm trying to change the post content of a page by hooking into the_post action, but the problem is that whatever I modify in there doesn't really get applied correctly. The problem seems to come ...
0
votes
1answer
16 views

Remove links from the_content when using filters wp_trim_excerpt

I'm using wp_trim_excerpt which is working perfectly but I want to strip the links contained in the the_excerpt (using get_the_content), I've looked online and tried many solutions to get the thing to ...
5
votes
2answers
2k views

How to remove the Theme Customization Button from the dashboard and themes options page?

In my Wordpress theme that I've currently been building I do not take advantage of the Wordpress Theme Customization API. As much as I would like too, I've invested far too much time into my own ...
0
votes
0answers
18 views

Remove Sidebar from Specific Product Category “Slug”, “not all” | Wordpress Woocommerce

My question is, Can i remove the sidebar only for particular URLs of my side. If the url is like below - remove the side bar and make the page full wridth ...
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
2answers
471 views

How to use the 'comments_number' filter?

I'm not sure how to use this filter. Could someone show me an example? I'm trying to change ('0', '1', '%') to ('0 Comments', '1 Comment', '% Comments'). I'm using this function to get the comments ...
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 ...
1
vote
1answer
22 views

Wordpress custom taxonomy check box to dropdown

Hi my custom taxonomy name is country.In this A is a country, a-sub1,a-sub2 are states under A. b-sub1,b-sub2 are state under Country B. Now i need to display the country list(parent) box and state ...
1
vote
0answers
42 views

template_redirect or admin-ajax.php?

My plugin needs to be reachable by the public and accept query vars. When called, it will run some backend db tasks, call a 3rd party API and sometimes redirect. Previously, I was using ...
1
vote
2answers
32 views

Returning ACF custom field from publish_post

I'm trying to return a custom field as soon as a post gets published. I'm using the publish_post (or {status}_{post_type}) action, but it looks like the custom fields are created after the hook. My ...
1
vote
2answers
206 views

Pass info from functions.php to plugin

What is the best way to pass some information from functions.php to a plugin? I need to give a user the ability to pass a piece of data from their functions.php file to my plugin. (It can be any ...
0
votes
1answer
39 views

Prevent attachment from being deleted

In Wordpress admin media library page (upload.php) I'd like to do some checking on delete_attachment action. I want my custom function to fire before attachment's being deleted. In this function I ...
-1
votes
1answer
147 views

add_filter to 'woocommerce_before_main_content' [closed]

I added a filter in functions.php and change priority very high and low to 1 but every time the parameter is an empty string""; add_filter( 'woocommerce_before_main_content','wc_start_layout'); ...
0
votes
2answers
600 views

How to use the password_reset hook to validate new password and display error

When a user resets their password via the link in the password reset email, I know I can use the password_reset hook to get the user object and the new password. I want to validate the new password to ...
0
votes
2answers
1k views

using wp_footer hook in a plugin

I'm using the wp_footer hook into the plugin and it doesn't work, but when I copy the code to the "functions.php" file of the active theme it does work, what is the possible problem in this situation ...
0
votes
0answers
12 views

Wrapping main content area of the blog page with a div by action or filter hooks

I used loop_start and loop_end hooks to wrap the main loop to load posts. But the problem is there are recent posts and category sections which is also getting wrapped up. I only want to wrap the main ...
-1
votes
2answers
69 views

WooCommerce - Overwrite action hook

Within the WooCommerce template file "content-product.php", I'm trying to overwrite the following action hook: /** * woocommerce_shop_loop_item_title hook * * @hooked ...
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
33 views

Template file structure , wordpress hook for altering the template

i need to convert a html structure to theme. So this is my html structure <html> <head> ................. </head> <body> <div class="main"> <div ...
0
votes
1answer
416 views

save_post not working with attachments

I've made a Meta Box for Posts and Pages, and while testing added Attachments too. But, curiously, the hook save_post does not fire. $cpts = apply_filters( 'my_filter', array( 'post', 'page' ) ); // ...
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
549 views

Ajax +wordpress onClick link redirect to new page and create html content

i have two pages in my wordpress plugin index.php charts.php in index.php i have some content and some link.. <a onclick="show_trend()" >Trend</a> while clicking this link ,i have ...
0
votes
1answer
50 views

woocommerce single product page hook not working

I have written a function which will display a date picker and a select box. I want this function output to be displayed on woocommerce single product page. So I assigned my function to a hook ...
1
vote
1answer
39 views

Cast string to number

Actually, I am using pre_get_posts hook with these configure $metaquery = array( 'relation' => 'OR', array( 'key' => 'price', ...
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 ...
0
votes
2answers
17 views

Make a custom column sortable by a value from a different custom post type

I've created some custom columns to display my custom post types more attractively in the admin section - the columns are mostly custom fields. Mostly, this works absolutely fine, and I can sort by ...
0
votes
0answers
12 views

Custom Post Type On Publish Update Meta Field

I'm wondering if someone can shed some light on how I can update a custom meta field value, when a new post is created in a custom post type? Specifically, I have a custom post type named ...
2
votes
1answer
666 views

save_post hook not triggered in WP v3.6.1

I developed a plugin having a custom metabox that is using the save_post hook to store data. The plugin is 18 months old and is used by thousands of customers, so I'm pretty sure everything is good. ...
6
votes
3answers
11k views

Hook for post and page load

I need to run a function when a particular post or page is loaded. Is there any hook that lets me check whether a post is being displayed during page load ?
0
votes
0answers
3 views

make a pluign javascript run windows load instead of document ready [migrated]

I have a plugin which is displaying wrapped in a document ready function, but i need to have it wrapped in a window load function. Can this be done using a hook or something? Its getting displayed ...
0
votes
0answers
17 views

Wrapping succeeding shortcodes together

I'm developing a WordPress theme where the gallery shortcode breaks out of my main content div. I haven't really put this in to practice but I'm thinking of theories how to accomplish this easily. ...
0
votes
1answer
15 views

Add %taxonmy in worpress custom permalink structure

In default wordpress support %category% tags in custom permalink structure. I need to use %taxonomy in permalink structure .How to do that ? is there any filter are available. Please help.
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
1answer
18 views

Add a custom class to the body tag using custom fields

There are certain posts where I want to manually append a custom body class to using custom fields. How do I go about it appending the class to the body tag when a certain custom field is added to a ...
0
votes
0answers
18 views

Multisite: Hook when wordpress creates new user record for a subsite

I'm trying to find an hook ( filter / action ) to catch when wordpress create new user record on a subsite. Example: Actually I've SiteA SiteB an user register itself on SiteA and ...
-1
votes
1answer
54 views

Access post meta just after publishing

the following code is supposed to store post meta of the recently published post to the variable $temp. But it doesn't, $temp is always empty. This seems to happen because "transition_post_status" ...
0
votes
1answer
537 views

get_post_meta not working inside a function in functions.php but works outside

function notify_new_posts($post_id) { $keyval = get_post_meta( $post_id); $buyer_wdistance = get_post_meta( $post_id, 'cf_wdrive'); //$buyer_wdistance = $keyval['cf_wdrive'][0]; ...
0
votes
2answers
70 views

Contact Form 7 - Execute code AFTER mail send

i've figured out how to do something BEFORE sending the mail, but i also need an action to happen AFTER it's been send. I tried wpcf7_after_send_mail but with no success... Any help on the matter ...
8
votes
2answers
6k views

Use wp init hook to call other hooks?

I want to know if it is a good practice according to WordPress theme or plugin development. add_action('init','all_my_hooks'); function all_my_hooks(){ // some initialization stuff here and then ...
0
votes
1answer
32 views

'comment_post' hook doesn't seem to work? [closed]

This is driving me crazy - Does anyone know why this 'comment_post' hook doesn't seem to work!? I've basically written an entire email notification plugin for it and it's failed on the first step. ...
0
votes
1answer
25 views

Hook for altering the content of all wp mails

Hi i want to set email template for all mails for my site . I know how to set up mail template and i set mail template for each of my mail by editing the code ie wp_mail( $recipient, $subject, ...