php - Create link to Author Archive in Tiny MCE in WordPress -


i wondering if has had same issue having. have users creating blog posts (using 'post' post type) talk other users. when directly mention user, link author archive page has been set each user.

can done? help, it's appreciated.

**edit **

i have function preg_replace_callback @"author slug" full name , url need wondering take develop tiny mce button/plugin possibly take inspiration bbpress mentions functionality on fly , not in essence use preg_replace_callback?

the code have is:

function the_content_func($content) { $ret = preg_replace_callback ( "/(@[a-za-z]+)/",     function ($match) {         $authorname = mb_substr($match[0], 1);         $author = get_user_by('slug', $authorname);         if ( ! empty( $author ) )             return '<a href="' . get_author_posts_url( $author->id, $author->user_nicename ) . '">' . $author->display_name . '</a>';         else             return $authorname;     }, $content); return $ret; }  add_filter('acf_the_content', 'the_content_func'); 

once again, appreciated.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -