Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

1
vote
2answers
86 views

Same Conditionals Not Working on Two Different Hooks

Everyone! I am new to WP and trying to build a plugin. I have the following codes working properly: add_filter('the_content', 'say_hello'); function say_hello($content){ if(is_single() || ...
0
votes
1answer
2k views

Help me to understand wp_header() and wp_footer() functions

hi everyone please help me to understand the hook functions wp_header() and wp_footer() What does it mean hook functions and what to do
1
vote
1answer
392 views

How can I tell if I'm on a login page?

There are functions for is_home(), is_blog() is_single() etc... What's the best way to tell if I'm on a page that is requesting that I login? I guess that would just be the wp-login.php page.
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 ...
0
votes
1answer
82 views

File names are being overridden when uploading new media

I want to hook into the media upload function and prefix file names with a timestamp. We're uploading a lot of stuff within a month, so we can't rely on the directory structure, and we're also dealing ...
0
votes
1answer
271 views

add action for displaying posts using a shortcode

I'm developing a simple plugin for letting a user insert a post from the frontend. I have a shortcode [add-post] which a user can put on any page, say, for eg. My Wall Page Now on My Wall Page a ...
0
votes
1answer
313 views

How to set Media Box form elements default value?

I am developing a plugin to customize wordpress administration. Creating / Editing an article, when i user insert an image from media library or uploading it, i want to clear the image title, as ...
0
votes
1answer
206 views

Defining hooks within (php)classes?

I have been trying to write a reusable modular options class and I am stuck at this specific point. How do i define hooks within php classes? Try 1 : class super_options { // ...
0
votes
1answer
82 views

Hooks to run after a core upgrade?

Are there any hooks for running plugin code after a core upgrade? Specifically, I'm running into issues that a users wp-admin column choice in the 'Screen Options' are modified after an upgrade - I ...
2
votes
1answer
362 views

When to call `add_rewrite_rule` for safety

I am starting to run into situations on projects where I am combining multiple plugins which all use add_rewrite_rule and flush_rewrite_rules at different points. As we all know, calling ...
0
votes
1answer
94 views

Display Plugin Panels Outside of Admin Areas

I'm trying to find a way to display the work area content of different plugins on pages/posts/areas aside from the admin backend. For example, how would I display the options panel for a certain ...
0
votes
1answer
360 views

run script on publish

I am trying to run a script when a user publishes / updates a post. I am using the filter: wp_insert_post_data The problem I am having is the script is a php file outside of WordPress but on the ...
1
vote
3answers
520 views

Two-step login process - Is it possible?

Is it possible to do the following with Wordpress (without hacking too much code - I would like to make this a general plugin using simple hooks)? Log in with the username/password. If ...
2
votes
1answer
63 views

Hooks for Links Box [duplicate]

Possible Duplicate: Getting archive pages in WP's AJAX internal link finder? Are there any hooks for the new internal links box that was created in WP 3.1? I'm trying to modify it in my ...
3
votes
2answers
752 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. ...
0
votes
1answer
200 views

Prepending character(s) to a custom <!--more--> tag title?

I'm hacking around with a blog using Cordobo Green Park and I've noticed when I specify a custom title, instead of it beginning with a » symbol (as it does for the standard "» Read more: ...
-1
votes
2answers
292 views

Are there any action like 'init_frontend'

I've found init and init_admin. Are there any action that executes just in the frontend? Thanks.
0
votes
1answer
2k views

Wordpress add_action the_post hook

Now i face a problem, that i want to add a hook into the the_post. Then i use print_r($post); here display the my print_r content and again display the default content. because i am here in ...
-1
votes
1answer
687 views

plugin: 'init' hook, check if we're not in admin

I've tried this inside of my plugin ('init' hook) but it doesn't work: if(is_front_page() || is_singular() || is_archive()) { ... } How could I check it using init hook? Thanks.
2
votes
3answers
281 views

Is it possible to remove this action? (as it's added just before it's called)

In wp-signup.php there are these lines: add_action( 'wp_head', 'wpmu_signup_stylesheet' ); get_header(); I need to remove wpmu_signup_stylesheet from the wp_head action, but I seem to be ...
0
votes
1answer
1k views

How to remove a meta description or other <head> contents

I have a plugin that generates a meta description or title as two of its features. However I run into the problem of other SEO plugins possibly being installed, and ending up with two meta ...
8
votes
3answers
5k views

How to enqueue scripts on custom post add/edit pages?

I'm trying to enqueue a JS script only when someone is adding or editing a custom post type I created called "recipes". Currently the script works ok when I do this: if (is_admin()){ ...
4
votes
1answer
2k views

get $post in init filter or action?

It seems that $post is only available to hooks executing at certain times. I have an "init" hook that needs to pull some data from the database using the $post->ID. So far my only workaround has ...
0
votes
2answers
949 views

Giving the_excerpt in the place of the_content?

Short and sweet — I wanted to deliver up the excerpt of a post in the place of the_content on certain pages. Naturally, if no excerpt is present one would be generated from the content. I ...
5
votes
2answers
2k views

Earliest hook to reliably get $post/$posts

What's the earliest possible action I can hook into where I'll be able to access the global $post/$posts variables on both the front and back ends? I've tried looking through the Codex reference, Adam ...
0
votes
1answer
967 views

Filter or Hook to catch pre-rendering of post content

Is there a filter or hook that is triggered just before post content is rendered? What I'd like to do is to apply a filter to the text content of a post just before the post text is being rendered.
0
votes
1answer
494 views

looking for wordpress action hook for new pending post?

Im looking for an action hook to link my function to when a completely new post is created with a status of pending? I'm aware of 'save_post' and others but want to target specifically when a post ...
0
votes
1answer
234 views

Post via wp-admin and via iOS app, same hooks and triggers involved?

I've got an add_action in functions.php, the action is for save_post and the function I'm running I've named set_attachment_url. I'm simply getting the first attachment on a post and setting a custom ...
6
votes
2answers
964 views

Extract image from content and set it as the featured image

The problem: I'm posting from the Wordpress iPhone app. When adding an image, the image shows up in the description itself, which I don't like. What I'm trying to do: Remove the image from the ...
1
vote
1answer
178 views

Send along login credentials with comment content

I'd like to allow my users to send their WordPress login credentials along with their comment, as opposed to having to log in first, and then post their comment. I'm not really sure where to hook into ...
27
votes
1answer
5k views

Where is the right place to register/enqueue scripts & styles

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use: to register and/or enqueue scripts and styles on front- and back-ends? Questions: Which are right hooks to ...
3
votes
2answers
249 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 ...
7
votes
1answer
844 views

Registering Class methods as hook callbacks

I'm not sure if I have done this correctly. As I understand it: if I have a class foo and a static method bar I can register that as the callback by passing the array array("foo","bar") as the ...
0
votes
1answer
190 views

Which hook to use when adding ajax to viewer-facing side?

I have a shortcode that contains a form. I want to use jQuery/Ajax for POSTing. For this, I want to add javascript to the page where shortcode is added? Which hook should I use? wp_enqueue_scripts ...
2
votes
3answers
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', ...
1
vote
2answers
1k views

What hook should be used to programmatically create a post only when master post is updated?

Pippin and Jean-Baptiste Jung have very good tutorials on how to programmatically create content when a new post is published using these four actions hooks... publish{post_type} ...
0
votes
1answer
30 views

Plugin Hook When New Author Added

Is there a way to add a hook for a plugin when a new author is added by the administrator? I would like to be able to add that user to my plugin database table. Thank you.
1
vote
1answer
403 views

Hook up MU site creation

I want to write a plugin so I can hook up the wp_install_defaults function. I actually need to do the following: when a new site is created, I want to import a default XML file with some categories ...
0
votes
2answers
507 views

How do I override the search template in a plugin?

How do I override the search template i.e. used inside a theme with a custom search page inside a plugin? Please point our any relevant action/filter hooks which can be used to do this. Any help is ...
2
votes
2answers
2k views

Hook/action after WP_Query gets posts to query custom tables for post-related meta

I see that there are hooks for manipulating WP_Query before it gets its posts (parse_query, pre_get_posts), but I can't seem to find any hooks for after the WP_Query object is populated. I have a ...
0
votes
3answers
617 views

How to retrieve the postID in a “image_send_to_editor” hook function?

Here is my function: function insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url ) { $postID = ??? $rel = "<a rel='shadowbox[".$postID."]'"; if ($url) {$html = ...
1
vote
1answer
434 views

Registration Hooks don't appear to be working

I am trying to hook in to automatically sign-in the user after registration. (using a GravityForms registration form). None of the hooks seem to be working. I've tried: gform_user_registered, ...
10
votes
5answers
2k views

How do you use a CPT as the default home page?

I have a client who's site will be making heavy use of custom post types to configure their site. But I'm between a rock and a hard place for their requested home page. In reality, the home page ...
0
votes
2answers
515 views

Change custom post type GUID in RSS

So i got the RSS feed which output some custom post types, but the GUID looks bad to me, it's like: ?post_type=mycustompost&p=124 The reason i want to change this is that I don't need people to ...
0
votes
1answer
404 views

How to display a link in the footer section

i'm using the BAAP Mobile version plugin and the footer link that switches between desktop and mobile version is being displayed outside of the wrapper>footer divs. Is there a hook or a method to have ...
6
votes
3answers
4k views

How to know what functions are hooked to an action/filter?

Is there a way to know what functions are hooked to a particular hook? For example if I'd like to know what functions are hooked to the wp_head hook.
1
vote
1answer
354 views

Hook any php file into the wordpress api

Say I just have a dumb .php file sitting on my WP server and I wanted it to access WP info through the API, how would I go about doing that? For example if I wanted to call bloginfo('url'); As I ...
5
votes
3answers
1k views

Changing Plugin Load Order

I'm writing a plugin, bar, which is dependent on another plugin, foo, being activated, and I need the functions from foo to be available when bar loads. Normally plugins are loaded in alphabetical ...
8
votes
2answers
6k views

How to hook update_post_meta and delete_post_meta?

I'm still struggling to get my head around this whole hooking into things, so I'm really stuck on trying to do the following task: If update_post_meta is fired then check to see if the meta_key is ...
1
vote
1answer
688 views

functions.php conditional tag - only show in single.php?

//Geo Map add_action( 'woo_post_inside_after', 'my_geo_mashup' ); function my_geo_mashup() { global $post; if ( in_category('listings') ) { echo GeoMashup::map(); } } Works to ...