WordPress Plugins > WP-EMail
404 Page with WP 3.0 Custom Post Types
(1/1)
ericwatkins:
So I've been playing around with WP-Email and custom post types in WP 3.0. The problem I have been finding is that everything still works fine when using the email links on normal blog posts and pages, but when using the email links on custom post types it gives a 404 page.
Has anyone found a work around for this yet? I have only sat down and really tried to hack this out for about 15 minutes, but it seems like it is in either wp_rewrite() or email_link(). Like a lot of other plugins, it just seems that the support for custom post types needs to be implemented.
So if anyone else has already worked this out, the help is appreciated. If not, maybe we can all figure it out so everyone can get it fixed up. Thanks all.
jmmonty79:
A great plugin and definitely hope this can be resolved as its perfect for a client project I am working on... I have managed to tweak the plugin code to remove the 404 error and get an email to send, just hoping to have some collobative help to work through some other items, such as getting the email to populate the email for custom post types.
I don't really have time to participate in forums, but will certainly post a fix back here once its done. You can see where we got to here:
http://www.realisingdesigns.com/weblog/2010/10/27/wp-email-custom-post-type-quick-fix/
jkohlbach:
For all those viewing this post looking to make this plugin compatible with WP3 and custom post types this is what you have to do:
Make the changes as described in jmmonty79's blog post above. It's pretty self explanatory so I won't repeat it here.
The final problem is that your emails will not have any contents in them. This is because when retrieving the post to populate the mail we need to specify the post type. In wp-email.php find the function process_email_form().
In this function you'll see a block of code that look like this:
--- Code: --- // Get Post Information
if($p > 0) {
$query_post = 'p='.$p;
$id = $p;
} else {
$query_post = 'page_id='.$page_id;
$id = $page_id;
}
query_posts($query_post);
--- End code ---
Swap it with this:
--- Code: ---// Get Post Information
if($p > 0) {
$post_type = get_post_type($p);
$query_post = 'p='. $p . '&post_type=' . $post_type;
$id = $p;
} else {
$query_post = 'page_id='.$page_id;
$id = $page_id;
}
query_posts($query_post);
--- End code ---
This should hopefully bring the plugin up to spec with WP3 post types. Lester, I'll shoot you an email so you can just copy and paste when you've got time!
GaMerZ:
Thanks jkohlbach http://plugins.trac.wordpress.org/changeset/389158
Navigation
[0] Message Index
Go to full version