Changing author slug for a custom role without using plugin

You can use add_permastruct() (with ep_mask set to EP_AUTHORS) to add the proper rewrite rules, and the author_link filter to set the proper author URL: add_action( ‘init’, function(){ add_permastruct( ‘%author_trip_vendor%’, ‘operator/%author%’, [ ‘ep_mask’ => EP_AUTHORS, ] ); } ); add_filter( ‘author_link’, function( $link, $author_id, $author_nicename ){ if ( user_can( $author_id, ‘trip_vendor’ ) ) { $link … Read more

What permissions does a role need for the user to be assigned as the author of a post?

You probably need to add 3 capabilities: edit_published_posts publish_posts delete_published_posts but at the very least, you need to add publish_posts as that is the capability WordPress uses to determine what users are shown in Authors drop-down. Note: Changing capabilities is stored in the database so the recommendation is to modify these values via a plugin … Read more

Return author name as a tag using get_author

<!–?php the_author(); ?–> is an HTML comment. Means it won’t fire the PHP inside it. As you already found out it should be <?php the_author(); ?> when placed in an PHP template file inside a so called The Loop. Which you are already doing right. Now there’s WordPress’ Template Hierarchy. Means you need to place … Read more

Assign author on ajax wp post insert

You’re almost there. Here’s the part that is setting the author of post to user with ID = 1: ‘post_author’ => 1, ‘post_status’ => ‘publish’, ‘post_type’ => ‘testimonial’, ‘author’ => $current_user->ID, You even try to set the author to $current_user, but you don’t initiate this variable anywhere in your code and you set author field … Read more

When clicking on author, it shows my email address in url

An URL-friendly version of your username (login) will be part of the url (slug/nicename) to your author archive page, unless your email is equal to your username. You can change this by a plugin like WP Author Slug. Then make sure your display name, as found on your profile page, is something you want people … Read more

How to list pages from an author?

And add the username to the array https://codex.wordpress.org/Function_Reference/get_pages <?php $args = array( ‘sort_order’ => ‘asc’, ‘sort_column’ => ‘post_title’, ‘hierarchical’ => 1, ‘exclude’ => ”, ‘include’ => ”, ‘meta_key’ => ”, ‘meta_value’ => ”, ‘authors’ => ”, ‘child_of’ => 0, ‘parent’ => -1, ‘exclude_tree’ => ”, ‘number’ => ”, ‘offset’ => 0, ‘post_type’ => ‘page’, ‘post_status’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)