Hi I'm trying to rewrite permalink structure for posts in one specific category, the structure should be category name - author name - post titleWhen I use the code below, there is no author name in the URLPlease, advise me where am I wrong.
add_filter( 'post_link', 'custom_permalink', 'author_link', 10, 3 );function custom_permalink( $permalink, $post, $leavename ) {// Get the category for the post$category = get_the_category($post->ID);if ( !empty($category) && $category[0]->cat_name == "Tips" ) { $cat_name = strtolower($category[0]->cat_name); $author_nickname = get_user_meta( $author_id, 'nickname', true ); $permalink = trailingslashit( home_url('/'. $cat_name . '/' . $author_nickname . '/' . $post->post_name .'/' ) );}return $permalink;}add_filter( 'category_link', 'custom_category_permalink', 10, 2 );function custom_category_permalink( $link, $cat_id ) {$slug = get_term_field( 'slug', $cat_id, 'category' );if ( ! is_wp_error( $slug ) && 'tips' === $slug ) { $link = home_url( user_trailingslashit( '/tips/', 'category' ) );}return $link;}add_action( 'init', 'custom_rewrite_rules' );function custom_rewrite_rules() {add_rewrite_rule('tips(?:/page/?([0-9]{1,})|)/?$','index.php?category_name=tips&paged=$matches[1]','top' // The rule position; either 'top' or 'bottom' (default).);add_rewrite_rule('tips/\d+/([^/]+)(?:/([0-9]+))?/?$', // <- here, add the \d+/'index.php?category_name=tips&name=$matches[1]&page=$matches[2]','top');}