Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

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: ...
0
votes
1answer
2k views

wp_insert_post hook for a wordpress plugin

I'm trying to make a wordpress plugin to auto-translate posts just before it's inserted, it's for a specific need where I want to write in a language, post in a different one, so far, I'm not able to ...
-2
votes
3answers
144 views

Apply function on all action hooks?

Is there an easy way to apply a function on all action hooks? I want to apply esc_attr() to every action hook (in a way that would work from functions.php or a plugin). I figure I would need ...
4
votes
4answers
4k views

Is there a way to set default custom fields when creating a post?

When I'm creating a new post, just after clicking "Add New", when the post editor shows, instead of having to use the dropdown and choose a custom field to use, I'd like to have some default custom ...
0
votes
1answer
3k views

How to automatically activate users after registration without activation email?

I want to auto-login my users after signup without an activation email requirement (I'm not concerned about spammers). How might I go about doing this? Thanks!
0
votes
1answer
320 views

Creating a plugin that will display text on every page

I know there is going to be an easy way to do this but I just can't seem to find the best practice for the following; I have a plugin which when complete should generate HTML on every page, I want it ...
0
votes
1answer
366 views

Filter for replacing the WP_query object for a given category

I'm looking for a action/filter to replace replace a category archive page with the contents of a page. I'm thinking of testing the category ID, and replacing the WP_Query object with a new one ...
2
votes
2answers
663 views

Display info from custom fields in all images' HTML

Okay, I've been working on this all day and can't find the solution anywhere. I've created a custom field within the image upload screen (info first found here). The field stores the name of a ...
6
votes
2answers
6k 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
416 views

Pass variable to hook. Its possible?

I have this hook created to retrieve user password when he register or update his pass. I dont want my client to touch wordpress core so i was planning to use a hook in wp-includes/user.php All this ...
2
votes
2answers
1k views

Get password when user registers and save it sha1 into database

im working on a website where the users can connect with iphone to some functions of it by using a sha1 encrypted password. In other words the plain password of wordpress encrypted in sha1. In the ...
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
3k 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
420 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
279 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
364 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
364 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
525 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
759 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
201 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
305 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
697 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
285 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
959 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
979 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
498 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
235 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
971 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
180 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
882 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
406 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
518 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 ...