URL Customization

To customize your URL layouts, go through the following codes.

Available Filters

Add PATH_INFO in $_SERVER Variable

add_filter( 'custom_permalinks_path_info', '__return_true' );

Disable redirects

To disable complete redirects functionality provided by this plugin, add the filter that looks like this:

function yasglobal_avoid_redirect( $permalink )
{
    return true;
}
add_filter( 'custom_permalinks_avoid_redirect', 'yasglobal_avoid_redirect' );

Disable specific redirects

To disable any specific redirect to be processed by this plugin, add the filter that looks like this:

function yasglobal_avoid_redirect( $permalink )
{
    // Replace 'testing-hello-world/' with the permalink you want to avoid
    if ( 'testing-hello-world/' === $permalink ) {
        return true;
    }

    return false;
}
add_filter( 'custom_permalinks_avoid_redirect', 'yasglobal_avoid_redirect' );

Exclude permalink to be processed

To exclude any Permalink to be processed by the plugin, add the filter that looks like this:

function yasglobal_xml_sitemap_url( $permalink )
{
    if ( false !== strpos( $permalink, 'sitemap.xml' ) ) {
        return '__true';
    }

    return;
}
add_filter( 'custom_permalinks_request_ignore', 'yasglobal_xml_sitemap_url' );

Exclude Post Type

To remove custom permalink form from any post type, add the filter that looks like this:

function yasglobal_exclude_post_types( $post_type )
{
    if ( 'custompost' === $post_type ) {
        return '__true';
    }

    return '__false';
}
add_filter( 'custom_permalinks_exclude_post_type', 'yasglobal_exclude_post_types' );

Exclude Posts

To exclude custom permalink form from any posts (based on ID, Template, etc), add the filter that looks like this:

function yasglobal_exclude_posts( $post )
{
    if ( 1557 === $post->ID ) {
        return true;
    }

    return false;
}
add_filter( 'custom_permalinks_exclude_posts', 'yasglobal_exclude_posts' );

Remove like query

To remove like query to being work, add below-mentioned line in your theme functions.php:

add_filter( 'cp_remove_like_query', '__return_false' );

Note: Use custom_permalinks_like_query filter if the URLs doesn’t works for you after upgrading to v1.2.9.