How to Change Author Posts URL

You can accomplish this with the following rewrite rule ( you’ll want to add this in your functions.php add_rewrite_rule( ‘author/([0-9]+)/?$’, ‘index.php?author=$matches[1]’, ‘top’ ); Be aware that you might need to flush your rules for it to become active. You can do this with rewrite plugin.

Function to check if author has posted within the last x days

Yes, it is possible and it is pretty small change in your code… get_posts() uses WP_Query, so you can use all params from this list: https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters So here’s your code after changes: $args = array( ‘post_type’ => ‘your_custom_post_type’, ‘author’ => get_current_user_id(), ‘date_query’ => array( array( ‘after’ => ‘- X days’, // <- change X to … Read more

Author url rewrite

Assuming you are using custom post types for songs, books etc: function add_rewrite_rules($rules) { $newrules[‘author/([^/]+)/songs/?$’] = ‘index.php?post_type=songs&author=$matches[1]’; $newrules[‘author/([^/]+)/songs/page/?([0-9]{1,})/?$’] = ‘index.php?post_type=songs&locations=$matches[1]&paged=$matches[2]’; $rules = $newrules + $rules; return $rules; } function flushRules() { global $wp_rewrite; $wp_rewrite->flush_rules(); } add_filter(‘rewrite_rules_array’, ‘add_rewrite_rules’); /* This function should only really be run once per change of rules – comment out */ add_filter(‘init’,’flushRules’); … Read more

Including post_type = ‘wiki’ in author archives

Author archives default to searching for posts of the post type post. You could override this with wiki like so; function wpse_11210_set_wiki_for_author( $query ) { if ( $query->is_main_query() && $query->is_author() ) $query->set( ‘post_type’, ‘wiki’ ); } add_action( ‘pre_get_posts’, ‘wpse_11210_set_wiki_for_author’ ); Drop it in your a plugin or your theme’s functions.php (if the file doesn’t exist, … Read more

Show only oldest post by author

To restrict users to just one post, don’t let them create new posts. Just add one wp_editor() instance to their profile. Hook into ‘show_user_profile’ and ‘edit_user_profile’ to show the editor. Hook into ‘personal_options_update’ and ‘edit_user_profile_update’ to save the content to a user meta or a hidden custom post type. Now they don’t have to search … Read more

Get the user type of an author

One way would be to use the get_the_author_meta function and pass it user_level More info on the function: http://codex.wordpress.org/Function_Reference/get_the_author_meta Then, see this chart to convert user levels to roles (unless you have created custom roles): http://codex.wordpress.org/Roles_and_Capabilities#User_Level_to_Role_Conversion Example code $level = get_the_author_meta(‘user_level’); if($level >= 8) { // Is admin // do something } else if ($level … Read more

How to develop a community feature in the dashboard for multiauthor site

What I do for almost every site with multiple authors: Create a separate blog for meta discussions, for example meta.example.com. Use P2 as theme. Install Authenticator to allow access for members only. Install something like Inform about Content, so the members get an email whenever something new was posted. I probably wouldn’t do that for … Read more

No authors in change author dropdown

The role “Reviewer” only has special capabilities, no other capabilities. To get into the author list you have to be at least a contributor or author. function rb_addroles() { $role = get_role(‘contributor’); remove_role( ‘reviewer’ ); add_role( ‘reviewer’, ‘Reviewer’, $role->capabilities ); $reviewer = get_role(‘reviewer’); $reviewer->add_cap( ‘edit_review’ ); $reviewer->add_cap( ‘read_review’ ); $reviewer->add_cap( ‘delete_review’ ); } add_action( ‘admin_init’, … Read more

Search posts by post author name

This line is likely the issue – $where = ” AND ( atl_posts.post_author = {$authorID} ) “; You are replacing the contents of $where, not changing it. You have to use . before = – $where.= ” AND ( atl_posts.post_author = {$authorID} ) “;

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