Permalink Manager Pro v2.2.17 – Best WordPress Permalink Plugin

最后更新于:2022-03-29 02:57:25

格尺建站系统(GeChiUI.com)是基于WordPress深度定制中文版建站系统,优秀的主题与插件都可以无缝迁移到GeChiUI中使用。

Permalink Manager Pro is the most advanced yet user-friendly permalink Plugin for WordPress. With Permalink Manager Pro you can easily control all your permalinks for your posts, pages, custom post types, categories, tags, custom taxonomies and WooCommerce store. It will also help you restore permalinks or replace any word in your URL with just a few clicks.

Permalinks are used to link to a specific blog or forum post, to a user profile on social network. A regular link sometimes contains a lot of service information (session number, current section of the site, etc.). Permanent links are more concise, easy to read, and contain only the information to go to the desired page.

演示: https://permalinkmanager.pro/

Features Permalink Manager Pro
  • Customize WooCommmerce permalinks
  • Custom post types & taxonomy permalinks
  • Edit multiple permalinks at once
  • Automatically redirect old permalinks
  • Add custom fields to WordPress permalinks
  • Duplicate permalinks slugs
= v2.2.17 (March 22, 2022) =
* Fix - Permalink Manager supports WPML's "Post Types & Taxonomy Translation" settings and returns the permalink of the fallback post/term with the correct language code
* Fix - When the auto-update mode for categories is disabled, the manually adjusted permalinks are no longer overwritten by the default ones
* Enhancement - Permalink Manager now allows you to rewrite just chosen articles and terms while leaving the rest untouched (See '"Auto-update" permalinks' settings field)
* Enhancement - Improved support for SEOPress breadcrumbs
* Enhancement - "Auto-update permalinks" setting is now replaced with "URI update mode" to give users better control on how Permalink Manager generates and saves the custom permalinks.
* Dev - Additional minor improvements in code

= v2.2.16 (January 23, 2021) =
* Enhancement - Improved support for "Primary category" feature included in Yoast SEO
* Enhancement - Added support for Avia/Enfold breadcrumbs filter
* Enhancement - Further optimisation and improvements for Permalink_Manager_Core_Functions->new_uri_redirect_and_404() function
* Fix - Permalink Manager now recognises the "Explore" listing page in MyListing theme properly

= 2.2.15 (January 12, 2021) =
* Enhancement - UI Improvements for Regenerate/reset tool
* Dev - WPML_URL_Filters->permalink_filter() hook is also used by Permalink Manager to filter custom permalinks.
* Enhancement - wp_make_link_relative() function is used to prevent redirect loops in new_uri_redirect_and_404() (suggested by mgussekloo)
* Fix - Enhancements to the debug function's security to avoid XSS injection.

= v2.2.14 (October 20, 2021) =
* Enhancement - Improvements for Gutenberg Editor
* Dev - Tippy.js (by atomiks) updated to version 6.3.2
* Fix - From now on, the user role selected in “URI Editor role capability” is respected in “Quick Edit” box hooks (reported by @lozeone)
* Dev - Further security improvements inside WP-Admin dashboard (reported by Vlad Vector)

= v2.2.13 (September 20, 2021) =
* Dev - Minor security improvements inside WP-Admin dashboard
* Fix - Allow canonical redirect for default language if "Hide URL language information for default language" is turned on in Polylang settings
* Enhancement - New settings field - "Primary category support"
* Enhancement - "Force 404 on non-existing pagination pages" works now with archive pages

= v2.2.12 (August 17, 2021) =
* Dev - New filters added - 'permalink_manager_excluded_post_ids' & 'permalink_manager_excluded_term_ids'
* Dev - Additional minor changes in the codebase
* Fix - Canonical permalinks for blog pagination is now correctly filtered (if Yoast SEO is used)
* Fix - Better support for 'private' posts & pages

= v2.2.11 (June 24, 2021) =
* Fix - The function that automatically removes the broken URIs is no longer triggered when WP Rocket is turned on and non-logged-in user tries to access the broken URL.

= v2.2.10 (June 7, 2021) =
* Enhancement - New settings field - "Copy query parameters to redirect target URL" & "Extra redirects (aliases)"
* Enhancement - UI improvements in settings section
* Dev - Improved support for WPML's Classic Translation Editor
* Dev - Additional minor changes in the codebase

= v2.2.9.9 (26/04/2021) =
* Fix - Hotfix for AMP WP integration

= v2.2.9.7 (11/03/2021) =
* Enhancement - Support for WooCommerce CSV Product Importer/Exporter added
* Enhancement - Better support for relationship field (ACF)
* Fix - The custom redirects are now case-insensitive

= v2.2.9.6 =
* Fix - Hotfix for WooCommerce coupon related functions

= v2.2.9.5 =
* Fix - The custom permalink is generated properly if the product is duplicated in WooCommerce dashboard
* Enhancement - New settings field - "Exclude drafts"
* Enhancement - Minor code improvements

= v2.2.9.4 =
* Fix - The language prefix for default language is now added again when "Use directory for default language" mode is turned on in WPML settings ("Language URL format")

= 2.2.9.3 =
* Fix - The custom permalinks are now saved correctly for new posts with 'wp_insert_post' hook
* Fix - The custom permalinks are deleted when 'delete_post' hook is called
* Fix - WPML - language switcher on posts (blog) page works correctly now
* Fix - WooCommerce Subscription - the switch subscription URL is no longer overwritten
* Fix - The URLs with duplicated trailing slashes are now redirected to the canonical permalink
* Enhancement - Basic support for Ultimate Member plugin added
* Enhancement - UI improvements
* Enhancement - New filter added - 'permalink_manager_control_trailing_slashes'

= v2.2.9.2 =
* Dev | Improvements for Permalink_Manager_Core_Functions::control_trailing_slashes() function
* Dev | Minor codebase improvements
* Fix | Hotfix for "Automatically fix broken URIs" function
* Fix | Underscores are now by default allowed in the custom permalinks
* Enhancement | Better support for GeoDirectory plugin
* Fix | 'permalink_manager_allow_new_post_uri' & 'permalink_manager_allow_update_post_uri' filter replaced 'permalink_manager_new_post_uri_{$post_object->post_type}' and 'permalink_manager_update_post_uri_{$post->post_type}'
* Hotfix for 'redirect_canonical' function (causing a redirect loop)
* The custom canonical permalink set with Yoast SEO is now no longer overwriten
* The custom permalinks are no longer saved if the post/term has no title
* Hotfix for Gutenberg related JS errors
* Hotfix for Groundhogg plugin
* Hotfix for "Customize" admin bar menu link
* Hotfix for WPML's language switcher on posts page
* Hotfixes for WP 5.5 - blog/posts page + draft template is now loaded correctly
* Trailing slash redirect code adjustments
* Added support for GeoDirectory plugin

Instructions to remove product slugs and product-category without using plugins

Remove the word product in the path

/*
* Code Remove /product/ or /shop/ ... that supports the %product_cat% format
* Replace /shop/ with your current slug
*/
function devvn_remove_slug( $post_link, $post ) {
    if ( !in_array( get_post_type($post), array( 'product' ) ) || 'publish' != $post->post_status ) {
        return $post_link;
    }
    if('product' == $post->post_type){
        $post_link = str_replace( '/cua-hang/', '/', $post_link ); //Replace shop with your current slug
    }else{
        $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
    }
    return $post_link;
}
add_filter( 'post_type_link', 'devvn_remove_slug', 10, 2 );
/*Fix 404 error after removing product slug or shop*/
function devvn_woo_product_rewrite_rules($flash = false) {
    global $wp_post_types, $wpdb;
    $siteLink = esc_url(home_url('/'));
    foreach ($wp_post_types as $type=>$custom_post) {
        if($type == 'product'){
            if ($custom_post->_builtin == false) {
                $querystr = "SELECT {$wpdb->posts}.post_name, {$wpdb->posts}.ID
                            FROM {$wpdb->posts} 
                            WHERE {$wpdb->posts}.post_status = 'publish' 
                            AND {$wpdb->posts}.post_type = '{$type}'";
                $posts = $wpdb->get_results($querystr, OBJECT);
                foreach ($posts as $post) {
                    $current_slug = get_permalink($post->ID);
                    $base_product = str_replace($siteLink,'',$current_slug);
                    add_rewrite_rule($base_product.'?$', "index.php?{$custom_post->query_var}={$post->post_name}", 'top');                    
                    add_rewrite_rule($base_product.'comment-page-([0-9]{1,})/?$', 'index.php?'.$custom_post->query_var.'='.$post->post_name.'&cpage=$matches[1]', 'top');
                    add_rewrite_rule($base_product.'(?:feed/)?(feed|rdf|rss|rss2|atom)/?$', 'index.php?'.$custom_post->query_var.'='.$post->post_name.'&feed=$matches[1]','top');
                }
            }
        }
    }
    if ($flash == true)
        flush_rewrite_rules(false);
}
add_action('init', 'devvn_woo_product_rewrite_rules');
/*Fix error when creating new product 404*/
function devvn_woo_new_product_post_save($post_id){
    global $wp_post_types;
    $post_type = get_post_type($post_id);
    foreach ($wp_post_types as $type=>$custom_post) {
        if ($custom_post->_builtin == false && $type == $post_type) {
            devvn_woo_product_rewrite_rules(true);
        }
    }
}
add_action('wp_insert_post', 'devvn_woo_new_product_post_save');

Remove the word product-category in the path

/*
* Remove product-category in URL
* Replace product-category with your current slug. Default is product-category
*/
add_filter( 'term_link', 'devvn_product_cat_permalink', 10, 3 );
function devvn_product_cat_permalink( $url, $term, $taxonomy ){
    switch ($taxonomy):
        case 'product_cat':
            $taxonomy_slug = 'product-category'; //Replace it with your current slug. Default is product-category
            if(strpos($url, $taxonomy_slug) === FALSE) break;
            $url = str_replace('/' . $taxonomy_slug, '', $url);
            break;
    endswitch;
    return $url;
}
// Add our custom product cat rewrite rules
function devvn_product_category_rewrite_rules($flash = false) {
    $terms = get_terms( array(
        'taxonomy' => 'product_cat',
        'post_type' => 'product',
        'hide_empty' => false,
    ));
    if($terms && !is_wp_error($terms)){
        $siteurl = esc_url(home_url('/'));
        foreach ($terms as $term){
            $term_slug = $term->slug;
            $baseterm = str_replace($siteurl,'',get_term_link($term->term_id,'product_cat'));
            add_rewrite_rule($baseterm.'?$','index.php?product_cat='.$term_slug,'top');
            add_rewrite_rule($baseterm.'page/([0-9]{1,})/?$', 'index.php?product_cat='.$term_slug.'&paged=$matches[1]','top');
            add_rewrite_rule($baseterm.'(?:feed/)?(feed|rdf|rss|rss2|atom)/?$', 'index.php?product_cat='.$term_slug.'&feed=$matches[1]','top');
        }
    }
    if ($flash == true)
        flush_rewrite_rules(false);
}
add_action('init', 'devvn_product_category_rewrite_rules');

/*Fix error when creating new taxonomy 404*/
add_action( 'create_term', 'devvn_new_product_cat_edit_success', 10, 2 );
function devvn_new_product_cat_edit_success( $term_id, $taxonomy ) {
    devvn_product_category_rewrite_rules(true);
}

Source: devvn

⭐另请参考: Summary of free premium WordPress plugins, daily updates

注意: 也许你需要在安装插件之前解压。 如果任何主题/插件包含病毒,我们不提供任何保证。在本地主机上使用,请先查杀病毒。