xytroyzy / wordpress-custom-content-type-manager

Automatically exported from code.google.com/p/wordpress-custom-content-type-manager
0 stars 0 forks source link

Permalink Rewrite not working for hierarchical Post Types #534

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Please make sure you are including enough information to make this a valid
bug report: https://code.google.com/p/wordpress-custom-content-type-
manager/wiki/ReportingBugs

What steps will reproduce the problem? (Be *specific*)

Turn on Permalink rewrite for any custom post type.

What is the expected output?
I expect it to go to the URL with the permlink address.  

What do you see instead?

It gets stuck in a redirect loop and never resolves the page.

Does the problem continue if you disable all other plugins? (plugin
conflicts cause a LOT of problems, so please isolate the problem)
It was working fine with the exact plugin setup until about 2 weeks ago.

Please copy and paste the system information that appears in a yellow
textarea when you click on "Report a Bug" on any CCTM admin screen (this
includes the version of the
plugin, the version of PHP, the version of MySQL, a list of other active
plugins etc.):

*SYSTEM INFO* 
------------------------ 
Plugin Version: 0.9.7.11-pl
WordPress Version: 3.7.1
PHP Version: 5.2.17
MySQL Version: 5.5.34-log
Server OS: Linux
Language: 
------------------------ 
ACTIVE PLUGINS: 
 * Advertisement Management v.1.0 [http://41016996.com/advertisement-management-plugin-for-wordpress/]
 * Akismet v.2.5.9 [http://akismet.com/?return=true]
 * Auto Tags v.0.5.1 [http://wordpress.org/extend/plugins/auto-tag/]
 * Capability Manager v.1.3.2 [http://alkivia.org/wordpress/capsman]
 * Easy Privacy Policy v.1.02 [http://europeancruiseadvisor.com/easy-privacy-policy]
 * JavaScript to Footer v.0.4.1 [http://www.prelovac.com/vladimir/wordpress-plugins/footer-javascript]
 * Formidable v.1.07.01 [http://formidablepro.com/]
 * G-Lock Double Opt-in Manager v.2.6.5 [http://www.glockeasymail.com/newsletter-plugin-wordpress/]
 * Gantry Template Framework v.4.0.8 [http://www.gantry-framework.org/]
 * Genesis Featured Widget Amplified v.0.8.1 [http://DesignsByNicktheGeek.com]
 * Genesis Simple Comments v.1.0.1 [http://DesignsByNicktheGeek.com]
 * Genesis Simple Menus v.0.2 [http://www.studiopress.com/plugins/simple-menus]
 * Genesis Slider v.0.9.6 [http://www.studiopress.com]
 * Genesis Toolbar Extras v.1.6.0 [http://genesisthemes.de/en/wp-plugins/genesis-toolbar-extras/]
 * Google XML Sitemaps v.3.4 [http://www.arnebrachhold.de/redir/sitemap-home/]
 * Jetpack by WordPress.com v.2.6 [http://wordpress.org/extend/plugins/jetpack/]
 * Map Cap v.2.1 [https://github.com/thenbrent/map-cap]
 * MapPress Easy Google Maps v.2.40.7 [http://www.wphostreviews.com/mappress]
 * nrelate Related Content v.0.52.6 [http://www.nrelate.com]
 * Platinum SEO Pack v.1.3.8 [http://techblissonline.com/platinum-seo-pack/]
 * Post-Plugin Library v.2.6.2.1 [http://rmarsh.com/plugins/post-plugin-library/]
 * Simple Taxonomy v.3.5 [https://github.com/herewithme/simple-taxonomy]
 * Smart Youtube PRO v.4.2.0 [http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube]
 * UpdraftPlus - Backup/Restore v.1.7.41 [http://updraftplus.com]
 * Video Thumbnails v.2.1 [http://refactored.co/plugins/video-thumbnails]
 * VigLink v.1.0.3 []
 * W3 Total Cache v.0.9.3 [http://www.w3-edge.com/wordpress-plugins/w3-total-cache/]
------------------------ 
CURRENT THEME: Magazine Child Theme v.2.1 
http://www.studiopress.com/themes/magazine

Original issue reported on code.google.com by startala...@gmail.com on 30 Nov 2013 at 12:17

GoogleCodeExporter commented 8 years ago
Issue 538 has been merged into this issue.

Original comment by ever...@fireproofsocks.com on 4 Jan 2014 at 5:37

GoogleCodeExporter commented 8 years ago
I my case I do not get a redirect loop, but a 404 error.

it happened on an installation where there was no problems
just after this 2 operations:

1) updated WP from 3.7.1 to 3.8
2) edited the Custom Post Type (wich has already numerous entries) flagging the 
"Hierarchical" option

turning off Permalink rewrite for that CPT (as suggested in wp Forums) did not 
solve.

On the contrary, problem was partially solved by this hack:
http://wordpress.org/support/topic/possible-issue-with-wp-38-cctm?replies=10

partially because it fix just first level post, child posts urls still give 404 
error

Original comment by bluanti...@gmail.com on 21 Jan 2014 at 6:53

GoogleCodeExporter commented 8 years ago

Original comment by ever...@fireproofsocks.com on 17 Feb 2014 at 5:28

GoogleCodeExporter commented 8 years ago
Issue 548 has been merged into this issue.

Original comment by ever...@fireproofsocks.com on 23 Mar 2014 at 6:37

GoogleCodeExporter commented 8 years ago
I donot have hierarchical option selected, still I am getting 404 error.

Original comment by ehsan.qu...@gmail.com on 23 Mar 2014 at 9:01

GoogleCodeExporter commented 8 years ago

I don't want disable friendly URLs because the project requires use of friendly 
URLs.
I am not able to report following bug.See deatiled information of issue.

Please make sure you are including enough information to make this a valid
bug report: https://code.google.com/p/wordpress-custom-content-type-
manager/wiki/ReportingBugs

What steps will reproduce the problem? (Be *specific*)
1.Add new post
2.when post saved as in draft
3. wrong permalink is saved and saving with different post name in permalink

What is the expected output?
Same post name will be used in permalink which i am creating in post title

What do you see instead?
Permalink is savd with different post name.

Does the problem continue if you disable all other plugins? (plugin
conflicts cause a LOT of problems, so please isolate the problem)
No

Please copy and paste the system information that appears in a yellow
textarea when you click on "Report a Bug" on any CCTM admin screen (this
includes the version of the
plugin, the version of PHP, the version of MySQL, a list of other active
plugins etc.):

Plugin Version: 0.9.7.11-pl
WordPress Version: 3.8.1
PHP Version: 5.3.20
MySQL Version: 5.1.61-log
Server OS: Linux

Original comment by seema.sharma@classicinformatics.com on 26 Mar 2014 at 12:54

Attachments:

GoogleCodeExporter commented 8 years ago
I've got a proof-of-concept fix working... should have this fixed very soon.

Original comment by ever...@fireproofsocks.com on 3 Apr 2014 at 4:59

GoogleCodeExporter commented 8 years ago
Any update on this coming out? I am really needing this feature, and love CCTM 
and would rather not have to find a new plugin

Original comment by airi...@gmail.com on 20 Aug 2014 at 8:34

GoogleCodeExporter commented 8 years ago
Development speed follows the funding, unfortunately, and I've had to work on 
paying gigs while this comes along.  The WP crowd in particular has proven to 
be particularly loth to allocate funding to development.

Original comment by ever...@fireproofsocks.com on 20 Aug 2014 at 4:21

GoogleCodeExporter commented 8 years ago
How much can I pay you to expedite this issue? Set your price and I will donate

Original comment by airi...@gmail.com on 1 Sep 2014 at 6:52

GoogleCodeExporter commented 8 years ago
Estimating this would be difficult since development includes refactoring the 
codebase, fixing many other bugs and fixing many other bugs.  If you would like 
to discuss, please contact me via the website: 
http://craftsmancoding.com/contact

Original comment by ever...@fireproofsocks.com on 4 Sep 2014 at 12:50

GoogleCodeExporter commented 8 years ago
Fixed this issue!

1. I made sure my .htaccess had the correct rewrite rules.

2. I unchecked Hierarchical (Under Content Types > Fields.}

Still didn't fix it.

But then I went under settings, writing > formatting 
and unchecked:
 Convert emoticons like :-) and :-P to graphics on display
 WordPress should correct invalidly nested XHTML automatically

I changed the PermaLink structure back to %postname% and finally my custom 
template is appearing instead of the media file.

I was able recheck the following without effecting the permalink function.
 Convert emoticons like :-) and :-P to graphics on display
 WordPress should correct invalidly nested XHTML automatically

It only took about 6 hours to solve this.  Ugh!

Original comment by gracebay...@gmail.com on 18 Apr 2015 at 5:45

GoogleCodeExporter commented 8 years ago
We updated to the latest version of WordPress 4.2.1 (?) 

after that time, the custom posts created using your product could not even 
find themselves from within the post editing screens (i.e. View or Preview) , 
and error 404 is common to all custom posts that we call "Projects".

example:
the menu 

http://clean50.com/project/atb-financial-financial-legacy-fund-unique-funding-st
ructure/

We can still use WP to edit or add new posts - and all the content remains - 
but when we click either preview or view page, the Error 404 kicks in.

We have: created a clone, made a copy, and created a new post - none of which 
have any different results.

HELP at Godaddy suggested (when looking at a trace of some sort) that something 
in the table is not updating properly - even though in my case the permalink 
and the URL are identical. 

I am trying to avoid rolling back to 3 weeks ago - but will do if need be...
Godaddy says this plugin is the problem

I have tried the fix noted above by gracebay - and have reset the default post 
name back and forth several times before and after each attempt.

neophyte that I am, have been unable to find / do Gracebay's suggested:
1. I made sure my .htaccess had the correct rewrite rules.
2. I unchecked Hierarchical (Under Content Types > Fields.

Error 404s persist...

*SYSTEM INFO* 
------------------------ 
Plugin Version: 0.9.7.13-pl
WordPress Version: 4.2.1
PHP Version: 5.3.24
MySQL Version: 5.0.96-log
Server OS: Linux
Language: 
------------------------ 
ACTIVE PLUGINS: 
 * bbPress v.2.5.7 [http://bbpress.org]
 * Captcha v.4.1.0 [http://bestwebsoft.com/products/]
 * Custom Content Type Manager : Advanced Custom Post Types v.0.9.7.13 [http://code.google.com/p/wordpress-custom-content-type-manager/]
 * Custom Field Template v.2.3.4 [http://wpgogo.com/development/custom-field-template.html]
 * Custom Post Templates v.1.5 [http://wordpress.org/extend/plugins/custom-post-template/]
 * Datafeedr Random Ads V2 v.2.0 [http://www.datafeedr.com/]
 * Delete Pending Comments v.0.2.1.1 [http://www.nkuttler.de/wordpress/delete-pending-comments/]
 * Duplicate Post v.2.6 [http://lopo.it/duplicate-post-plugin/]
 * Easy FancyBox v.1.5.7 [http://status301.net/wordpress-plugins/easy-fancybox/]
 * Hide Title v.1.0.4 [http://dojodigital.com]
 * Meta Box v.4.5 [http://metabox.io]
 * Go Daddy Quick Setup v.1.04 [http://www.godaddy.com/]
 * Regenerate Thumbnails v.2.2.4 [http://www.viper007bond.com/wordpress-plugins/regenerate-thumbnails/]
 * Simple Page Ordering v.2.2.4 [http://10up.com/plugins/simple-page-ordering-wordpress/]
 * Welcome to WordPress v.1.0 []
 * Widget Logic v.0.57 [http://wordpress.org/extend/plugins/widget-logic/]
 * WordPress Twitter Bootstrap CSS v.3.2.0-4 [http://www.icontrolwp.com/wordpress-twitter-bootstrap-css-plugin-home/]
 * WordPress Importer v.0.6.1 [http://wordpress.org/extend/plugins/wordpress-importer/]
 * YOP Poll v.5.6 [http://www.yop-poll.com]
------------------------ 
CURRENT THEME: Clean50 v.1.0 http://mattnigh.com

Original comment by gavinpit...@gmail.com on 30 Apr 2015 at 1:04

GoogleCodeExporter commented 8 years ago
@gavinpit - I'm also been a victim of this change in Wordpress and the 404 
errors. Been working on it all day. The only way to fix at the moment is the 
'Mike' hack. 

https://wordpress.org/support/topic/possible-issue-with-wp-38-cctm?replies=23

/* Populate the query variable
------------------------------------------------------------ */
function pros_add_rewrite_rules($aRules) {
    $aNewRules = array('pros/([^/]+)/?$' => 'index.php?post_type=pros&name=$matches[1]');
    $aRules = $aNewRules + $aRules;
    return $aRules;
}

// hook add_rewrite_rules function into rewrite_rules_array
//
if ( !is_admin() ) {
    add_filter('rewrite_rules_array', 'pros_add_rewrite_rules');
    }

This works and makes the rewritten urls findable again. No more 404s.

It looks like this plugin is not supported any more. Does anyone have any 
recommendations for a replacement plugin that can take over the management of 
the existing custom post types? I've tried a few but no luck with them yet.

Original comment by ad...@audenguitars.com on 4 May 2015 at 11:10

GoogleCodeExporter commented 8 years ago
The plugin is supported, but it has never really been properly funded.  Please 
make a donation before making a statement like that.

Original comment by ever...@fireproofsocks.com on 6 May 2015 at 5:21

GoogleCodeExporter commented 8 years ago
To reproduce:

1. Create a custom post type
2. Under its definition, select the Fields tab and then check "Page Attributes" 
and "Hierarchical"
3. Under the URL tab, select permalink action to be /%postname%/
4. Create a post using the custom post type
5. View the post on the front end

Expected: the page
Actual: 404

Original comment by ever...@fireproofsocks.com on 6 May 2015 at 11:57

GoogleCodeExporter commented 8 years ago
I've (re)confirmed that this is an issue with the WP core.  To reproduce, you 
can create a simple plugin, e.g. using the following code:

function pt_test() { $args = array( 'public' => true, 'label' => 'Books', 'hierarchical' => true, 'supports' => Array ( 'title', 'editor', 'page-attributes' ), ); register_post_type( 'book', $args ); } add_action( 'init', 'pt_test' );


With all other plugins disabled, and only this simple plugin enabled, any posts 
created in that post-type come up 404.  The above "rewrite_rules_array" 
workaround does work.  So the challenge is to make that workaround applicable 
dynamically.  Ideally, the core wouldn't have this problem, but I'm not holding 
my breath that it will be corrected in a sane way.

Original comment by ever...@fireproofsocks.com on 7 May 2015 at 6:07

GoogleCodeExporter commented 8 years ago
I've tracked this down to the query_var.  The behavior of URL rewrites is 
different when the query_var is null or empty vs. omitting the argument.  This 
is problematic and bad coding on the part of WP, but it's unlikely to be 
changed even if a bug report were filed.  Now that I know what's been causing 
this, I can work out a solution.

Original comment by ever...@fireproofsocks.com on 8 May 2015 at 10:46

GoogleCodeExporter commented 8 years ago
The following changes appear to fix the issue:

Inside the includes/CCTM.php, insert this into the end of the 
_prepare_post_type_def function, around line 437:
    if (isset($def['query_var']) && empty($def['query_var']))
    {
        unset($def['query_var']);
    }

Original comment by ever...@fireproofsocks.com on 8 May 2015 at 10:49

GoogleCodeExporter commented 8 years ago
0.9.8.4 released.

Committed revision 1156557.

Original comment by ever...@fireproofsocks.com on 8 May 2015 at 11:04

GoogleCodeExporter commented 8 years ago
Issue 586 has been merged into this issue.

Original comment by ever...@fireproofsocks.com on 9 May 2015 at 3:10