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.
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?
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' );
Hello,
thanks Brandon i already found how to replace that part of the link,
but without that it gives me a 404 error
cheers
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.
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.
Perfect, it worked like a charm. Thanks for your time
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.