Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

1
vote
4answers
2k views

How to inject content after <body>

I would like to inject some elements directly after the <body> tag. Is that possible using only WordPress hooks?
5
votes
2answers
371 views

Is there any debug toolbar that shows whick hooks are called for the current page in Wordpress?

In Django there is a debug toolbar that shows which template files and hooks are called while rendering a page. Is there any plugin that shows which hooks are called for the current page in ...
3
votes
2answers
2k 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 ...
1
vote
2answers
121 views

Failed to invoke other hook from the init hook

Related to this question (Use wp init hook to call other hooks?) but not the same. Sometimes, I found that the hook will failed to run when I place inside the init hook, e.g. Not Work: ...
0
votes
2answers
647 views

How to Modify Default Text in a Custom Taxonomy Admin Panel?

I’d like to make a tiny change in one of my custom taxonomy admin panels: rename the label "Description" to "Title".
2
votes
1answer
1k views

WP Multisite: Adding pages on blog creation by default

I’d like to have a page added by default when a new site is created with WP Multisite. So I have my function that creates two pages: function my_default_pages() { $default_pages = ...
1
vote
1answer
179 views

Checking post format during xmlrpc_publish_post

WordPress apparently stores post format information outside of the $post object. During publish_post this isn't (usually) a problem because you can check on formats via get_post_format( $post->ID ) ...
6
votes
2answers
1k views

Action hook for custom tax edit

So, i have a function in my template file functions.php which cache a search form that contain a custom taxonomie terms. I want to flush cache (or delete one cache group) when I add/delete/edit terms ...
2
votes
0answers
34 views

How to hook into unregistering a widget instance?

I would like to hook into a widget instance after it is removed from a sidebar panel on the Appearances -> Widgets admin page. So if the instance was an active widget and then removed, I would like ...
0
votes
1answer
2k views

Filter WooCommerce Orders

I am using woocommerce for a "multi-seller" system. Meaning one site (no multi-site), but many sellers with different products. To let each owner only manage it's own orders, it would like to filter ...
0
votes
1answer
363 views

Change the look of the media uploader

I have been trying to find out for a while now if there is a way to totally change the look of the pop up media uploader. How can I alter the content and the layout of that page? Which hooks should I ...
3
votes
5answers
504 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?
0
votes
2answers
221 views

Query author's posts & posts that have author's id as meta value

I am trying to get posts with an author's ID as a meta value in the author.php template using additional request parameter. For example I want posts with john's ID as a meta value using a request ...
-1
votes
1answer
535 views

How do I change TinyMCE button “i” to create a i tag rather than em? [duplicate]

I want to give the "italic" button back the "styling" behaviour, rather than the spammy <em>. I want that button to print a <i> tag, rather than <em>. <em> tags became popular ...
1
vote
1answer
3k views

Execute function when post is published

I try to use this function i have created when a post is published for the first time. function a_new_post($post){ $post_id = $post->ID; if ( !get_post_meta( $post_id, 'firstpublish', $single ...
1
vote
1answer
329 views

Adding option to Gallery shortcode

just starting out in WP dev, and I'm looking for any guidance I can get. What I'd like to do is use a hook or filter to add my own option to the core WP gallery shortcode. I would want it to work just ...
6
votes
3answers
10k 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 ?
-2
votes
1answer
139 views

add_action failed to display function by a plugin

I am using a plugin which has the following function: See end of question. And I've created a hook in my template file: <?php custom_hook(); ?> And this is what I have in my functions.php ...
1
vote
1answer
1k views

Add action hook conditionally - only when home.php in use

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 ...
3
votes
2answers
1k 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 ...
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 ...
2
votes
1answer
215 views

How to debug removal of rewrite rule flushing?

I use Custom Post Types. I try this: functions.php add_action( 'admin_init', 'flush_rewrite_rules' ); Now I’d like to remove this again. I try this: remove_action( 'admin_init', ...
1
vote
0answers
108 views

Firing a function AFTER redirect

I am using a function that redirects the user to a custom page, rather than wp-login in the event of errors. In my case I am using the Http Referer function to send the user back to the same page ...
1
vote
1answer
305 views

Strange behaviour with add_{$meta_type}_metadata | add_post_metadata filter

I'm unsuccesfully trying to use the add_{$meta_type}_metadata. This filter is called inside add_metadata function (wp-includes/meta.php:31 in Wordpress 3.4.2). In particular I wanna hook ...
2
votes
2answers
206 views

Hook for URL request

I would like to make XML files downloadable, instead of allowing the browser to displaying them inline. I know I can use the Content-Disposition: attachment HTTP header (of course, better solutions ...
0
votes
1answer
415 views

How to get the password and username of the add new user form (admin back end) in wordpress

I am trying to get the username and password that entered by the wordpress admin in the add new user screen to use those into creating a webmail account using cpanel api. How to do that? is there is ...
0
votes
1answer
580 views

Add custom fields after post/page title

I am using the Headway theme, and I need to add custom field code to page & posttitles. This is what I need to be able to do. The red button will be added through a custom field. It needs to be ...
0
votes
1answer
318 views

How to access variables in the function where apply_filters() is called?

I am trying to filter some data based on whether a variable from within the function that calls apply_filters() is equal to specific value. That variable is not passed to the apply_filters() ...
0
votes
2answers
133 views

Looking for Hook that is fired after a plugin or wp upgrade is installed/updated

I'm trying to write some code to sms me whenever someone updates/installs a plugin, or updates the WP core, but I can't seem to find a hook that gets fired when this happens. Does anyone know if there ...
5
votes
1answer
807 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 ...
0
votes
2answers
557 views

Put code into body tags near top, using a plugin

How do I use a plugin to put this inside the body of every page on my WP site, for facebook integration. (Yes, I know other plugins can do it, but I want to do it myself.) Facebook recommends as close ...
0
votes
2answers
545 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 ...
6
votes
2answers
129 views

Valid characters for actions, hooks and filters

I haven't ever seen a tag such as do_action('something_10'). Is it invalid if I use numbers? If the method is valid, how can I write different numbers in the tag string conditionally? For example, is ...
1
vote
0answers
90 views

Copy post to separate database with “add_action(…)”

I'm basically trying to have a copy of a post be sent to another database's table when it's published. I've gotten it to add a new row in the new table, with my own static arguments, but I'm not sure ...
2
votes
1answer
318 views

wp_ajax_[service] returning 0

I have a few Ajax services that I'm setting up. All of them require being logged in so I've attached hooks into the "wp_ajax_[$service]". The problem is when I call these services I just get a "0" ...
0
votes
1answer
129 views

manipulate a plugins shortcode

I want to add some javascript directly below content, added by another plugin's shortcode. We are using the NextGen Gallery plugin and there are many articles containing the [nggallery] shortcode. I ...
10
votes
2answers
450 views

Hierarchical taxonomy UI

I don't like the way the taxonomies are displayed within the Wordpress admin and was wondering if anyone knew the best way to hook in and change it. Currently if I select some terms within my post ...
1
vote
1answer
124 views

Hook when new CPT published AND postmeta inserted

I would like to know if there is a hook that fires when a new CPT is published and its postmeta has been inserted. I was using publish_mycpt but found that the postmeta wasn't being saved at that ...
0
votes
1answer
326 views

When is the {$new_status}_{$post->post_type} transition hook fired?

Is it fired after a post has been published? Say I have a CPT and want to perform some automated actions based on the post that gets saved, can I do: add_action('publish_myt_cpt', ...
-1
votes
1answer
2k views

Do New_to_publish hooks work for custom post types

Do these hooks listed on the following site work for custom post types? http://www.wphub.com/custom-post-type-publish-action-hook/ // function to be executed when a custom post type is ...
0
votes
1answer
395 views

Plugin init hook

Is there a plugin init hook that runs whenever the plugin is being loaded? I'd like to link the functions for requiring files and defining constants to such a hook if it exists.
3
votes
1answer
1k 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 ...
-1
votes
1answer
482 views

Adding a wp_head hook from an included PHP file

I am using a WordPress plugin for including PHP code within posts and pages, and it's working great - however, I need to insert some styles and scripts, and in order to do that, I need to add a hook ...
0
votes
1answer
191 views

Force resize for all video content

I'm looking for a way to force all video content on my site to scale to 100% width and I'm hoping to avoid using any additional javascript. Is there a filter or function that I can use to accomplish ...
6
votes
2answers
3k views

Save_post for custom post type?

Is there a save_post hook for custom post types? example: save_my_post_type I know there is publish_my_post_type but I'm looking for a save hook.
-1
votes
1answer
113 views

How to automatically create a custom field when a post is published?

I'm trying to add custom fields on post publish with this code which I added to my functions.php : add_action('publish_page', 'add_custom_field_automatically'); add_action('publish_post'. ...
0
votes
2answers
425 views

Divs appearing everywhere in post content

Whenever somebody writes a post on our site, the Paly Voice (http://palyvoice.com) there are automatically a lot of <div> elements created. This is bad for layout, since we have a style that ...
0
votes
1answer
384 views

What filter or action hook to use in order to load some code before the template begins printing in BuddyPress? [closed]

I would like to load some code before the template begins printing in BuddyPress. What filter or action hook should I use? I tried a number of them (such as bp_head, bp_include, bp_init), but none of ...
0
votes
1answer
174 views

Modify message displayed on post save

After a post is updated there is a message displayed, how can I change the displayed text? I would like to remove the "view post" link and change the 'Post published' text. I'd like to do this for a ...
0
votes
2answers
65 views

Which hook should be used in this case?

I'm using the enter_title_here filter to modify the 'Enter title here' text in a custom post type, question is what hook should I use to trigger this function? I have used admin_enqueue_script as a ...