You can do it with the pre_get_posts
hook. In WP_Query there is an author
parameter : https://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters
pre_get_posts
hook : https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
function wpse_288986_remove_post_from_author($query) {
// We have to check if we are in front and if the query is the main query
if(!is_admin() && $query->is_main_query() && is_archive())
{
$query->set('author', -2); // Where 2 is your user ID
}
}
add_action('pre_get_posts', 'wpse_288986_remove_post_from_author');
EDIT : This code goes into your functions.php
file
Related Posts:
- Show modified time if post is actually modified
- AJAX handler throws 400 (Bad request) – why?
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Most elegant way to enqueue scripts in function.php with foreach loop
- WordPress – thumbnail image from youtube (function and loop)
- Adding WooCommerce to a Custom Theme – not working [closed]
- Editing or filtering the output of the Genesis navigation
- A snippet after every image
- Function to show only first instance of shortcode
- Automatically insert php function into post $the_content
- Creating loop within functions.php
- Display WooCommerce subscriptions for user [closed]
- How to use max and min values of custom fields
- Custom Shortcode, functions PHP WP_Query loop
- Filtering posts by category name based on page’s slug
- 2 Loops, Only Displaying 1 Loop in Both Loops
- Having a Function Inside of the Loop
- Getting different functions data while using while loop in wordpress
- Create a new query in function.php to filter blog posts
- Limit length of first excerpt in the loop
- Default Custom Field Value Automatically Update
- Multiple Loops Meta Data
- Why doesn’t is_page(id) work in functions.php?
- if statement for wordpress default featured image on single post
- The Loop not looping?
- While loop with an exception after a count is reached
- How do I pull excerpts from pages?
- Output loop to function return?
- issue with if/elseif in_array inside foreach loop display only one post
- get_next_posts_link() returns no result despite available posts
- Problem with calling custom function in a foreach loop
- Get term slug by term id and then explode it
- Using functions.php to include code that’s processed inline
- Using two loops in one WordPress template
- Breaking up multiple words and inserting an image after first word
- Simplest Way to Build Custom Archives Page?
- Woocommerce Variable Product Dropdown for Custom Shop Template
- the_date() and the_time() functions display actual date an time instead of published date and time
- How set a while with a function
- Pass post ID from archive template to functions file
- Prevent function from triggering on current page
- How to use `foreach()` in ajax call
- Code executes outside of Loop while same code gives ‘Uninitialized string offset’ notice inside a while loop
- Only seems to be displaying one child when there are supposed to be multiple
- Integrate WP Tiles into existing loop (index.php) and theme
- Check if excerpt is empty at loop-portfolio
- Function to get the name in database table from the comma separated string
- Syling Custom Fields echo’s from from functions.php
- Getting rid of the blog page entirely
- Way of getting queried loop before the query with a filter hook?
- Post variables not displaying correctly in custom function
- Why don’t some template tags work when querying information on single.php?
- how to handle multiple forloop?
- Parse error: syntax error, unexpected ‘endforeach’ (T_ENDFOREACH) in [closed]
- How do grab the main loop, with conditions, and output via shortcodes
- Creating mixture of shortcodes to use in the visual/text editor
- Get full slug for a WordPress Post
- Update post meta with wp cron
- Programatically add options to “add new” custom field dropdown
- Excluding iPad from wp_is_mobile
- Use ‘add_theme_support’ instead of ‘add_custom_image_header’ In WordPress 3.4
- Replacing select2 in admin backend for all selects
- How to hook into the quick edit action?
- I created a child theme and it doesn’t work for some of the css files
- How to detect first visit of a user?
- How to programmatically set a menu to be the Primary Menu?
- How to hide, and not to remove the attributes metabox?
- how to edit functions.php in a child theme
- Only display link to author social media when it exists [closed]
- Get current page_id before loop, in functions.php
- Menu fallback “menu_class” rendering a “div” instead of a “ul”
- Create single.php for specific tag by tag id or name
- Using $themename Variables
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- How to auto refresh when user change postcode
- Add sequential number to a Gravityforms form
- How to display retweet count and likes in the meta above the excerpt
- Possible to hook into Media Library preview File column and use a custom image?
- Programmatically add Yoast meta description after post save
- Woocommerce checkout field
- Warning: preg_match(): No ending delimiter ‘^’ found in
- How to Add Shortcode to html img code?
- Logout Redirect and also WP-login.php Redirect
- Proper Way to Load stylesheet on Condition
- Insert Content Before div#main from the functions.php File
- Conditional custom menu?
- What function actually renders the wp_admin_bar ? How can I call it?
- redirecting a URL if accessed directly
- Detect Ajax call inside pre_get_posts function
- What is wp_get_post_tags for media tags?
- Filter works on last selection but no others
- WordPress does not load jQuery
- get_current_user_id() always return 0 in if else statement
- How fix error in the WordPress loop?
- I need to ‘wp_dequeue_script’ and ‘styles’ and ADD a bunch of other css and js
- How to use if (is_page_template (”))
- wordpress function through ajax not being called
- Automatically add custom fields (post_meta) to all published posts, hourly, via wp_cron?
- update_post_meta after form is submited
- What function does the loop of displaying posts?