Get 404 when try open author page

Your example would be accurate if we were talking about a post type, but authors behave a little differently. WordPress automatically creates specific author pages (like your /author-1 example) but does not have a fallback scenario for showing a list of the authors. (More details on how the template hierarchy works can be found here) … Read more

Only allow posts with a specific term to only be viewed by other authors with the same term in their post

You’d do something like $current_user = wp_get_current_user(); to get the current user, then you’d want their posts $current_user_posts = get_posts(array( ‘author’ => $current_user->ID, ‘posts_per_page’ => -1 ); with their posts, you’d cycle through them, and grab the terms $current_user_terms = array(); foreach ($current_user_posts as $user_post) { $user_terms = wp_get_post_terms($user_post->ID, ‘custom_tax’, array(“fields” => “ids”)); foreach ($user_terms … Read more

Auto assign author to new posts with wp_insert_post_data

to know if it’s a new post, you juste need to read the value of $postarr[“ID”] : $postType = “post”; add_filter(“wp_insert_post_data” . $postType, function ($data, $postarr) { if (0 === $postarr[“ID”]) { // it’s a new post $data[“post_author”] = 45; } return $data; }, 10, 2);

Disable WordPress Comment Author Name

Switty uses a standard WordPress comments implementation, so the following, added to your proper child theme functions.php, will erase comment author names. The function could be written as an anonymous function – so very short – but I figured you just might want to return something in place of the name, plus anonymous functions are … Read more

Post by category+author not working!

why this code is ignoring the author id It’s not ignoring the author ID. But with that code, you need to call setup_postdata(), like this: //global $post; // Uncomment if necessary. $current_user = wp_get_current_user(); //$current_user->ID; $post_ref = get_posts( array( ‘author’ => $current_user->ID, ‘numberposts’ => 1, ‘cat’ => 31 ) ); foreach( $post_ref as $post ): … Read more

I’ve removed my /author/ slug but it clashes with new and existing pages. Any fixes?

There is no way around uniqueness being necessary, with the effects you described. Personally I wouldn’t remove the part that makes ensuring uniqueness of the slug much easier, like the author part, in my mind it is just a sign of a well structured site. Anyhow, there is validate_username() function with the validate_username hook. You … Read more

OceanWP settings are missing from Add New Post [closed]

It looks like you can hook into the ocean_main_metabox_capabilities filter: It is defined in /plugins/ocean-extra/includes/metabox/metabox.php: $capabilities = apply_filters( ‘ocean_main_metaboxes_capabilities’, ‘manage_options’ ); In your child theme or a custom plugin, try the following (for example, in /themes/mytheme/functions.php: add_filter( ‘ocean_main_metaboxes_capabilities’, ‘my_custom_metabox_role’ ); /** * Change the default role used to display the Ocean Extra metabox. * * … Read more

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