Error after upgrade 1.2.7
-
Hello!
Seems you have an error somewhere with permalinks.
Function get_permalink() seems to returns permalink structure if the plugin is enabled.
Here is a link: https://rubika.com.ua/en/project/website-development-for-a-construction-companyThere is a breadcrumbs in the bottom and the function returns:
rubika.com.ua/en/project/%portfolio%#head-block
instead of
rubika.com.ua/en/project/website-development-for-a-construction-company#head-block
It’s a custom post type, pages seems works fine.
Using Plugins:- Custom Post Type Permalinks Plugin
- No Category Base (WPML)
Thanks.
-
This topic was modified 7 years, 4 months ago by
Nikita_Sp.
-
This topic was modified 7 years, 4 months ago by
Nikita_Sp.
-
This topic was modified 7 years, 4 months ago by
Nikita_Sp.
The page I need help with: [log in to see the link]
-
Hi Nikita
From which version have you upgraded the plugin? I mean, were you using the 1.2.5 version before upgrade?
Can you please confirm either it’s working fine before or not? Does you recently upgraded the WPML Version?
I have checked the get_permalink() and it’s working fine for me with custom post types but i am not using WPML.
Thanks,
Sami-
This reply was modified 7 years, 4 months ago by
Sami Ahmed Siddiqui.
I was using the latest versions of plugin. Than seems polylang updated. Than yours.
I’m trying to keep plugins updated all the time, but seems that it’s not a good idea. ??
Try to use it with WPML.-
This reply was modified 7 years, 4 months ago by
Nikita_Sp.
Hi @nikitasp Updated the version with some changes. Not sure whether it solves your issue or not. But, recommend you to update it.
Would love to know your feedback regarding the latest version.
Thanks,
SamiHi, @sasiddiqui, I’ve updated the plugin.
Nothing works.
Thanks.That error must be fixed ASAP!!!!
Google take my schema data with links like:
https://domain/project/%portfolio%Look, let’s figure out what’s wrong. Because I’ve tried to disable all extensions and the error was there.
I’ve got the next parameters of custom post types:
function register_my_cpts() { $labels = array( "name" => __( "Projects types", "rubika-theme"), "singular_name" => __( "Project type", "rubika-theme"), "menu_name" => __( "Project types", "rubika-theme"), "all_items" => __( "All project types", "rubika-theme"), "edit_item" => __( "Edit project type", "rubika-theme"), "view_item" => __( "View project type", "rubika-theme"), "update_item" => __( "Update project type", "rubika-theme"), "add_new_item" => __( "Add project type", "rubika-theme"), "new_item_name" => __( "New project type", "rubika-theme"), "parent_item" => __( "Parent project type", "rubika-theme"), "parent_item_colon" => __( "Parent project type:", "rubika-theme"), "search_items" => __( "Search project type", "rubika-theme"), "popular_items" => __( "Popular project types", "rubika-theme"), "separate_items_with_commas" => __( "Separate project types with commas", "rubika-theme"), "add_or_remove_items" => __( "Add or remove project types", "rubika-theme"), "choose_from_most_used" => __( "Choose from most used project types", "rubika-theme"), "not_found" => __( "No project types found", "rubika-theme"), "no_terms" => __( "No project types", "rubika-theme"), ); $args = array( "label" => __( "Project types", "rubika-theme"), "labels" => $labels, "public" => true, "hierarchical" => false, "label" => "Project types", "show_ui" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "query_var" => true, "rewrite" => array( 'slug' => 'portfolio', 'with_front' => false, ), "show_admin_column" => false, "show_in_rest" => false, "rest_base" => "", "show_in_quick_edit" => false, ); register_taxonomy( "portfolio_type", array( "portfolio" ), $args ); $labels = array( "name" => __( "Portfolio", "rubika-theme"), "singular_name" => __( "Project", "rubika-theme"), "menu_name" => __( "Portfolio", "rubika-theme"), "all_items" => __( "All projects", "rubika-theme"), "add_new" => __( "Add new", "rubika-theme"), "add_new_item" => __( "Add new project", "rubika-theme"), "edit_item" => __( "Edit project", "rubika-theme"), "new_item" => __( "New project", "rubika-theme"), "view_item" => __( "View project", "rubika-theme"), "view_items" => __( "View projects", "rubika-theme"), "search_items" => __( "Serach projects", "rubika-theme"), "not_found" => __( "No projects found", "rubika-theme"), "not_found_in_trash" => __( "No projects found in transh", "rubika-theme"), "parent_item_colon" => __( "Parent project", "rubika-theme"), "featured_image" => __( "Featured image for the project", "rubika-theme"), "set_featured_image" => __( "Set featured image", "rubika-theme"), "remove_featured_image" => __( "Remove featured image", "rubika-theme"), "use_featured_image" => __( "Use as featured image", "rubika-theme"), "archives" => __( "Projects archive", "rubika-theme"), "insert_into_item" => __( "Insert into projects", "rubika-theme"), "uploaded_to_this_item" => __( "Upload to the project", "rubika-theme"), "parent_item_colon" => __( "Parent project", "rubika-theme"), ); $args = array( "label" => __( "Portfolio", "rubika-theme"), "labels" => $labels, "description" => "", "public" => true, "publicly_queryable" => true, "show_ui" => true, "show_in_rest" => false, "rest_base" => "", "has_archive" => "portfolio", "show_in_menu" => true, "exclude_from_search" => false, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "rewrite" => array( "slug" => "project", "with_front" => true ), "query_var" => true, "supports" => array( "title", "editor", "thumbnail", 'author' ), "taxonomies" => array( "portfolio_type" ), ); register_post_type( "portfolio", $args ); $labels = array( "name" => __( "Reviews", "rubika-theme"), "singular_name" => __( "Review", "rubika-theme"), "menu_name" => __( "Reviews", "rubika-theme"), "all_items" => __( "All reviews", "rubika-theme"), "add_new" => __( "Add new", "rubika-theme"), "add_new_item" => __( "Add new review", "rubika-theme"), "edit_item" => __( "Edit review", "rubika-theme"), "new_item" => __( "New review", "rubika-theme"), "view_item" => __( "View review", "rubika-theme"), "view_items" => __( "View reviews", "rubika-theme"), "search_items" => __( "Search review", "rubika-theme"), "not_found" => __( "No review found", "rubika-theme"), "not_found_in_trash" => __( "No review found in trash", "rubika-theme"), "parent_item_colon" => __( "Parent review", "rubika-theme"), "featured_image" => __( "Review featured", "rubika-theme"), "set_featured_image" => __( "Set review featured", "rubika-theme"), "remove_featured_image" => __( "Remove review featured", "rubika-theme"), "use_featured_image" => __( "Use review featured", "rubika-theme"), "archives" => __( "Review archive", "rubika-theme"), "insert_into_item" => __( "Insert into review", "rubika-theme"), "uploaded_to_this_item" => __( "Upload to review", "rubika-theme"), "parent_item_colon" => __( "Parent review", "rubika-theme"), ); $args = array( "label" => __( "Reviews", "rubika-theme"), "labels" => $labels, "description" => "", "public" => true, "publicly_queryable" => true, "show_ui" => true, "show_in_rest" => false, "rest_base" => "", "has_archive" => "reviews", "show_in_menu" => true, "exclude_from_search" => false, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "rewrite" => array( "slug" => "review", "with_front" => true ), "query_var" => true, "supports" => array( "title", "editor", "thumbnail", 'author'), ); register_post_type( "review", $args ); } add_action( 'init', 'register_my_cpts' );
So, maybe it’s because of custom terms?
Please, stay in touch.Thanks.
Hello!
I’ve disabled all extensions and I can see that the error is with Polylang.
Some conflict there.Please, fix it ASAP.
Thanks.
So, I’ve got some new info: you have an error somewhere in custom_permalinks_request function.
The thing is that this func doesn’t return the original URL if this is a custom post type.Searching more…
So, in your code there is such logic:
You search post in Database that has custom permalink. But my custom post type post doesn’t have it.So, the var $original_url === NULL is true.
Than you get option “custom_permalink_table” and it’s false.
just return $query on 126 line.So seems works fine.
Also I’ve tried to disable polylang. And everything was fine.
So seems that this is their problem.This adds next urls:
https://rubika/project/%portfolio% on custom post type page
and
https://rubika/%postname% on native post page.Hey there again!
I’ve got the solution!
Please, provide it to next versions!The bug is here (class-custom-permalinks-frontend.php on line 352):
require_once ABSPATH . '/wp-admin/includes/post.php'; list( $permalink, $post_name ) = get_sample_permalink( $post_id );
First of all, why do you hardcode? Wp-admin to front… It seems not good for me, but maybe I don’t know something, it’s ok.
Anyway this is the reason of the error.But seems I found a solution:
You need to replace your hardcode with:$post = get_post( $post_id ); $post_name = $post->post_name; if($post->post_type == "post"){ $permalink = get_option( 'permalink_structure' ); }else{ // If custom post types permalinks is installed try to get this option $permalink = get_option( $post->post_type.'_structure', false ); if($permalink == false ){ $permalink = get_option( 'permalink_structure' ); } }
Please, reply.
Thanks.Hi @nikitasp
Thanks for providing the solution and it’s good to see that your provided solution fixes your problem but i can’t add this solution in the coming version of the plugin as it has some issues which breaks someone other site.
Secondly, This issue doesn’t belongs to this plugin. This issue belongs to the Polylang Plugin. I think, that has already been fixed in their latest version.
Please grab the latest version Polylang and remove your updated code from the plugin or reinstall the Custom Permalinks Plugin.
Hopefully, you would not found any issue.
For more info, Have a look of the Polylang github repo:
https://github.com/polylang/polylang/commit/f15c6af8c7d20f763fcf45922a61702577d7f716#diff-da3dc5fb3f3986b8314fc00a2b4cd998L114Thanks,
Sami -
This reply was modified 7 years, 4 months ago by
- The topic ‘Error after upgrade 1.2.7’ is closed to new replies.