• Resolved Ramboz89

    (@ramboz89)


    Hi there,

    Your plugin is really nice thanks for that, I only have a problem now that i set a custom permalink for blog posts.

    It applies for author as well,googling about that problem it looks like i need to disable the property “with_front”. Can you help with this issue?

    Example

    my blog posts have got this link structure
    domain.com/news-from-london/blogpost-slug
    author
    domain.com/news-from-london/slug-choosen-by-role/author-slug
    i just need
    domain.com/slug-choosen-by-role/author-slug

    cheers

    https://www.ads-software.com/plugins/edit-author-slug/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Brandon Allen

    (@thebrandonallen)

    I guess that depends on how “news-from-london” appeared in the first place. Did you change the “Site Address” option, or did this happen some other way.

    Thread Starter Ramboz89

    (@ramboz89)

    Hi Brandon,

    thanks for your time,

    i’ve just set up my with that custom structure.

    other custom type wasn’t affected by this change.

    your plugin is set up as setting author base according to their role. could it help?

    Plugin Author Brandon Allen

    (@thebrandonallen)

    You could try something like this in your theme’s functions.php file

    function my_author_link( $link = '' ) {
    	return str_replace( 'news-from-london/', '', $link );
    }
    add_filter( 'author_link', 'my_author_link' );
    Thread Starter Ramboz89

    (@ramboz89)

    Hello,

    thanks Brandon i already found how to replace that part of the link,
    but without that it gives me a 404 error

    cheers

    Plugin Author Brandon Allen

    (@thebrandonallen)

    Try changing the above code to

    function my_author_link() {
    	global $wp_rewrite;
    	$wp_rewrite->author_structure = str_replace( 'news-from-london/', '', $wp_rewrite->author_structure );
    }
    add_action( 'init ', 'my_author_link' );

    Then go to Settings > Permalinks and click save.

    The previous code worked for me, but I still don’t really know how you set up your permalink settings. I’m not a my computer to test the new code, so I can’t give any assurances that it will work.

    To answer your earlier question, no, setting the author base to be role-based won’t have an effect. Let me know if this works, if not, I’ll try to find a solution when I get a chance.

    Plugin Author Brandon Allen

    (@thebrandonallen)

    Had some time to sit down and work this out.

    This should work

    function my_author_link() {
    	global $wp_rewrite;
    	$wp_rewrite->author_structure = $wp_rewrite->author_base . '/%author%';
    }
    add_action( 'init', 'my_author_link' );

    Same as above applies. You need to go to Settings > Permalinks and click save. Then all should be well. Using this approach, it’s not longer necessary to filter ‘author_link’ as I first showed, and you stated you already tried.

    Thread Starter Ramboz89

    (@ramboz89)

    Perfect, it worked like a charm. Thanks for your time

    Plugin Author Brandon Allen

    (@thebrandonallen)

    Glad you got it fixed!

    Plugin Author Brandon Allen

    (@thebrandonallen)

    I’ve just release version 1.2.0 which adds this functionality. If you are still using any of the code above, please remove it before using the built-on version.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Problem with front’ is closed to new replies.