All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.

Author Topic: 404 Page with WP 3.0 Custom Post Types  (Read 3695 times)

0 Members and 1 Guest are viewing this topic.

Offline ericwatkins

  • Newbie
  • *
  • Posts: 2
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: Wave
404 Page with WP 3.0 Custom Post Types
« on: 09 July 2010, 18:42 »
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.

Offline jmmonty79

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: Custom
Re: 404 Page with WP 3.0 Custom Post Types
« Reply #1 on: 27 October 2010, 14:25 »
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/


Offline jkohlbach

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: Custom Made
Re: 404 Page with WP 3.0 Custom Post Types
« Reply #2 on: 05 November 2010, 04:36 »
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: [Select]
// 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);

Swap it with this:

Code: [Select]
// 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);

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!

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,692
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: lesterchan.net v3.4

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.