Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

4
votes
1answer
6k views

Is there a way to send HTML formatted emails with Wordpress' wp_mail function?

Is there an action_hook or something similar that could help me achieve this? I tried adding markup in a PHP string variable and just fired off an email with the wp_mail function like so: $email_to ...
4
votes
1answer
107 views

How Do I Load My Action Earlier Enough?

With add_action, I want to intercept as early as I can in my plugin and send a 304 Not Modified header per some rules. Does anyone know what the order is of events? When I view this page, it seems to ...
4
votes
3answers
511 views

Is there a hook to put stylesheet and/or JS inside iframes (thickbox or tinyMCE) in admin area

I'm working on my admin area theme and I wanted to make some modifications on the way the thickbox and tinyMCE looks. I could make most of the changes through adding custom stylesheets and JS to my ...
4
votes
1answer
660 views

Is there a Wordpress core & plugins update action hook?

I would like to run several actions on a website once WP core or any of the plugins have been updated using the built-in update process. Is there a way to do it? I would prefer if I could run ...
4
votes
1answer
482 views

What is the action hook for save media-form on gallery tab?

I want to save a meta data to post parent when the media-form on gallery tab is saved( The submission button is "Save All Changes"). Which action hook can I use?
4
votes
1answer
273 views

How do I flush the rules after saving settings using the Settings API?

I'm using the Settings API to allow the user to toggle the has_archive option on some custom post types. When the user turns archives on or off, I want to flush the rewrite rules. If I had written ...
3
votes
2answers
158 views

Adding function directly vs using hook in function.php

We can use functions like register_nav_menu() directly in function.php and it works and we can also use a function to put register_nav_menu() inside of it and attach that function using a hook like ...
3
votes
1answer
3k views

Difference between after_setup_theme and init action hooks?

What is the difference between the after_setup_theme and init action hooks? It seems they are both called right before any page in WordPress is loaded (even admin pages).
3
votes
3answers
3k views

How to hook wp_list_pages?

How can I hook the wp_list_pages function so that it reads a value of a custom field and displays it instead of displaying the page title?
3
votes
2answers
765 views

Custom theme hooks / filters - passing arguments

I'm getting confused trying to implement these custom theme hooks. Trying to wrap my head around that. I thought i understood this. but now after reading code for several hours; it's made it worst. ...
3
votes
4answers
2k views

Unregister post type from child theme

I'm trying to unregister a post type from a child theme but I haven't been able to do so, the code in the funcions.php file on the parent theme is something like this: add_action( 'init', ...
3
votes
3answers
2k views

Wordpress hook before inserting post into database

I need to do check the inserted post for certain keywords and perform some functions depending on the keywords found. is there a wordpress hook that executes "just before the post is inserted into ...
3
votes
2answers
728 views

How To Determine If A Filter Is Called In A Sidebar/Widget Context?

So I have a plugin that appends or prepends an enhanced author biography to the content of a page/post/custom post type. It does this by hooking to either the_content or the_excerpt and ...
3
votes
3answers
536 views

wp_mail - Remove sitename from email subject

Can some one tell me how to remove site name from email subject. As of now my email subject looks like this [sitename] - Subject goes here I want it to look like this Subject goes here I ...
3
votes
1answer
268 views

Hook into admin post list page

So I want to create a custom admin interface for the post and page lists. I want it to be a split view with a list of posts and some data on the left, and a full editable preview of the post on the ...
3
votes
1answer
299 views

Is there an action for when permalinks are rebuilt?

In my plugin, I have a list of titles and permalinks in the options table. It's updated every time my custom post type is saved. Since I'm saving permalinks the option data can become bad if the ...
3
votes
3answers
3k views

Hooking a function onto the sidebar?

I'm looking for a way to add some content to the top of the sidebar when it get's loaded. I've tried hooking onto the get_sidebar action as referenced here, but it seems to override the sidebar call ...
3
votes
1answer
9k views

How to customize woocommerce related products?

I have the following lines of code in my website that will display the related products at the bottom of my single product page in WooCommerce... functions.php: // display upsells and related ...
3
votes
1answer
3k views

How to use the_excerpt in a filter hook?

I was hoping to process the_excerpt just like one would with the_content, but no such luck. How can I pass the excerpts of a Posts Page, through my plugin? I've tried variations on this: ...
3
votes
2answers
251 views

Identify which loop you are hooking into; primary or secondary?

What is the most efficient way to determine which loop I'm in? I have a few plugins that alter the query by hooking into various parts of WP_Query::get_posts(), through the usual suspects, ie ...
3
votes
2answers
528 views

Seeking clarification on page request life-cycle

I'm just trying to get my head around the "life-cycle" of a typical page request in WordPress. The Action Reference page lists 38 actions that occur during a typical page load, but two things aren't ...
3
votes
1answer
69 views

Disallow a user to post in certain categories

I am writing a plugin that will disallow user to post in certain categories. I am trying to display an error message to the user when he tries to post in the restricted category and also want WP ...
3
votes
1answer
2k views

How to create thumbnails for PDF uploads?

I'm developing a website that needs to allow users, within Gravity Forms, to submit a PDF file and have a JPG thumbnail created of the first page of the PDF that is then displayed in the created post. ...
3
votes
1answer
212 views

Perform action on WPMU blog deletion

Hi guys :) I know there is the wpmu_new_blog action hook which enables us to perform an action when a new WPMU blog is created. Is there something similar to this which enables us to perform an action ...
3
votes
1answer
2k views

Trigger custom action when setting button pressed

This is my first wordpress plugin and I'm running a lot of trouble making it work, it almost work fine but I don't find a way to accomplish this specific thing. Basically I've my custom setting page ...
3
votes
1answer
847 views

Hooks for trashing, deleting, saving, restoring custom post type

I need some hooks especially for trashing and untrashing custom post types. However the hooks are not so clear in this case. For example, to run a function on trash, I can use ...
3
votes
1answer
654 views

Is there a filter/action to add content to WP admin metaboxes?

I want to add an instruction into a custom term meta-box. Is there a hook to add this or is it easiest just to use JavaScript?
3
votes
1answer
194 views

Call activation hook multiple times

I have a plugin that does some initialization stuff using register_activation_hook called from its __construct(). I've since extended my plugin to add functionality to it. For the sake of ...
3
votes
2answers
452 views

Action hook 'wp' firing twice… why?

I noticed that when I hook into 'wp' it seems to be firing twice -- for example add_action('wp', 'just_testing'); function just_testing(){ global $post; error_log($post->ID); } returns ...
3
votes
3answers
723 views

How to Debug the 'save_post' Action?

Is it possible to validate PHP code? I have a Custom Post Type (Film) with Custom Meta Boxes. Everything is working fine, I can add new Films and details to the Custom Meta Boxes. My problem is ...
3
votes
2answers
1k 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 ...
3
votes
1answer
297 views

Determining a Widget Instance and Sidebar Location?

When using the filter: add_filter('widget_display_callback', 'function_name'); function function_name($instance) { /* Some Code */ return $instance; } Is it possible to determine the sidebar ...
3
votes
1answer
579 views

Want to redirect if search query match exact title of any post

I am using WordPress 3.3.1 and new to this system. I want to redirect the search query to the post if query exactly matches post title of some post. I also want it to run before any search query ...
3
votes
2answers
75 views

What hook is executed just after wp_query has been executed?

What hook is executed just after wp_query has been executed? before template is rendered? I want to change the page title but it depends on what has been queried. I have put it in template_redirect ...
3
votes
1answer
23 views

Change text of Description in Image Library

i would like to change or add text to the Media Library Overlay on the right side if you click on an image and can enter a description for the image. At the moment there stands "Description" or ...
3
votes
1answer
765 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 ...
3
votes
1answer
301 views

get_query_var() not working in pre_get_posts

I'm using the pre_get_posts hook to order the main query on all my custom post type / taxonomy pages using a custom meta value. As part of the logic, I am trying to determine which taxonomy is ...
3
votes
5answers
402 views

How do I make a theme “plugin-ready”?

How do I revise a theme so that I can publish my event hooks and anyone can build a plugin to add new functionality easily to my theme?
3
votes
1answer
1k views

Using action hooks inside of a shortcode

I am trying to create a modular plugin that includes action hooks for developers to add content before and after the main shortcode content. I'm having some trouble because anything I do in the ...
3
votes
2answers
356 views

Which hook should be used to validate custom form fields on the login form?

I've added a custom input field with login_form hook. So, I need to process the post data to validate. I've used the lostpassword_post for lostpassword_form and works great, but I cant find a hook to ...
3
votes
1answer
167 views

How should I intercept the main query and inject custom join / order by / group by criteria

I have a CPT that is a member of two separate taxonomies. On the taxonomy archive page for one of the taxonomies, I need to further group and sort on the second taxonomy like so: ...
3
votes
1answer
353 views

The 'user_has_cap' hook seems to take two page loads to trigger

This question relates to another question I asked recently (http://wordpress.stackexchange.com/questions/29009/how-to-assign-specific-users-the-capability-to-edit-specific-pages-posts-cus/), the ...
3
votes
1answer
930 views

Any Hook Called When Post Becomes Published?

Posts may be published either immediately or in the future. Suppose a plug-in wants to do something at the moment when the post becomes published and visible on the blog (I don't mean when the post ...
2
votes
2answers
6k views

Use latest jQuery in WordPress (admin interface)

I want to use the latest jQuery (and jQuery UI) versions on my admin interface (editing a specific post type that I created). I tried this: // jQuery 1.x wp_register_script('jquery1x', ...
2
votes
5answers
6k views

Adding onload to body

I'm currently trying to develop a plugin that will embed a Google Earth Tour into a WP post / page via a shortcode. The issue I am running into is that for the tour to load, I have to add an ...
2
votes
2answers
2k views

Why isn't is_home() working correctly?

I put a if(is_home()) bit in my theme's functions.php and it doesn't seem to work. The function containing this bit is called on init so is_home should work already.
2
votes
2answers
2k views

How do I implement the Wordpress Iris picker into my plugin on the front-end?

This question here is asking the same question as I am, but there were no adequate answers nor a selected correct answer so I am asking again hoping if I ask in a more coherent manner I might get a ...
2
votes
2answers
629 views

Wordpress Admin Tooltip hooks

I want to know if there is a way to use Wordpress Adminitration Tooltips (de gray and blue ones) that are shown one you update your worpdress (3.x). Showing the new features. Thanks!
2
votes
2answers
2k views

How do I “unhook” / de-register jQuery so that it's not called as part of wp_footer();?

I need to "unhook" jQuery from my wp_footer() ... it's being called automatically and I'm looking for something I can add to functions.php which prevents it from being called a second time in the ...
2
votes
1answer
139 views

What does (10, 2) mean when used with add_filter

Please tell my what is 10, 2 in below mention code: add_filter('nav_menu_css_class', 'add_active_class', 10, 2 ); function add_active_class($classes, $item) { if($item->menu_item_parent == 0 ...