WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type Permalinks
BBPress topic links in forums break (8 posts)

  1. faeronsayn
    Member
    Posted 1 year ago #

    After enabling this plugin, the BBPress topic links in forums break for some odd reason. I've left the fields blank, and I've also tried copying the exact structure of the permalinks prior to the addition of the add-on. The permalinks work perfectly, it's just the the links in the BBpress forum break.

    For some very unknown reason enabling a plugin (Custom Post Type Permalinks) is causing bbPress topics permalinks to break. But it’s actually quite weird.

    With the plugin disabled this is the permalink for the topics

    http://example.net/forums/topic/%post-name%/

    When the plugin is enabled this is the permalink for the topics

    http://example.net/forums/topic/%post-name%/

    That’s right, there is no change in the structure of the permalink or the permalink it self.

    If I were to copy and paste the link when the plugin is turned on, it’ll point me to the post perfectly fine.

    The problem is when I try to click on the topic through the forum navigation, it returns a 404 page not found error. The reason is because of the following.

    Through the forum it’s trying to point to the following url for the topic …

    http://example.net/forums/topic/forum-category/forum-sub1/%post-name%/

    For some awkward reason when the plugin is turned on, it doesn’t actually modify the permalinks of the topics at all. I don’t even know what it does, but it causes bbpress to go beserk and some how come up with that link. When I click on that link when the plugin is turned on it comes up with a 404 error.

    When the plugin is turned off, the navigation through the forums provide the following permalink to the topic

    http://example.net/forums/topic/%post-name%/

    Exactly the same as it’s actual permalink so no 404 errors are generated.

    If anyone can help me debug this annoying and awkward issue it would be great.

    Once again, it’s the link for the topic in the forum that’s being changed for some reason when the plugin is active.

    I need this plugin for other custom post types.

    http://wordpress.org/extend/plugins/custom-post-type-permalinks/

  2. Chee Studio
    Member
    Posted 1 year ago #

    I finally figured out how to get these two plugins to work. It seems this plugin wants to derive the post type's custom taxonomy parents and append them to everything. I just commented out this function which is on lines 247 to 254 of the plugin:

    /*  
    
    // Commented out to fix BBPress 404 errors
    
    	$parentsDirs = "";
    		if( !$leavename ){
    			$postId = $post->ID;
    			while ($parent = get_post($postId)->post_parent) {
    				$parentsDirs = get_post($parent)->post_name."/".$parentsDirs;
    				$postId = $parent;
    			}
    		} */

    This fixes BBPress, but if you are using the Custom Post Type Permalinks plugin with nested custom taxonomies, you're gonna have a bad time.

    But, if not, this is a decent enough fix.

  3. Fulgence Ridal
    Member
    Posted 1 year ago #

    thx a lot ... it solves the bbpress prb ...
    but it crashes custom taxonomies permalinks. hug !

    is-it possible to make a conditionnal argument to accept this function if permalink is taxonomy and do not use this function if permalink is forum ?

    thx

  4. Chee Studio
    Member
    Posted 1 year ago #

    Interesting...that did not happen for me. Did you re-save your Permalink structure to flush the Permalinks cache?

    There is a way to write that conditional function, but I am just not sure how to do it! :) You should post this to WordPress Stack Exchange:

    http://wordpress.stackexchange.com/

  5. jankowalski
    Member
    Posted 1 year ago #

    2.2.4 messsed up on my site. similar problems with custom post types and permalinks, any fix comming up?

  6. Fulgence Ridal
    Member
    Posted 1 year ago #

    in fact a solution consists to activate the plugin to configure the good rewrite_rule.
    And after desactivate without flushing rules. and it seems to be ok.

    A second soltion ... learn rewrite rules( my solution).

  7. aarapov
    Member
    Posted 1 year ago #

    Or you can exclude the post_types that are related to bbPress with
    if ( !in_array($post_type, array('topic', 'forum', 'reply') ) ) .

    Mentioned above code with the modification:

    $parentsDirs = "";
    if( !$leavename ){
    	$postId = $post->ID;
    	if ( !in_array($post_type, array('topic', 'forum', 'reply') ) ) {
    		while ($parent = get_post($postId)->post_parent) {
    			$parentsDirs = get_post($parent)->post_name."/".$parentsDirs;
    			$postId = $parent;
    		}
    	}
    }
  8. dbungard
    Member
    Posted 1 year ago #

    Its late so maybe I'm missing something but how do you put the dynamic of the forum name into the new links?

    I'm trying to make this read:
    http://www.MyURL.com/forums/FORUM_NAME/Topic/ and so on

    I have a rule based on URL name that I NEED (and of course asap cuz I've been trouble shooting this way too long) the forum name to show up it's topics

    THANKS!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic