Disabling the sitemap is easy, just add this line to your functions.php
:
add_filter( 'wp_sitemaps_enabled', '__return_false' );
Removing specific posts goes like this:
add_filter(
'wp_sitemaps_posts_query_args',
function( $args, $post_type ) {
if ( 'post' !== $post_type ) {
return $args;
}
$args['post__not_in'] = isset( $args['post__not_in'] ) ? $args['post__not_in'] : array();
$args['post__not_in'][] = 123; // 123 is the ID of the post to exclude.
return $args;
},
10,
2
);
There a quite a lot of ways to customize the sitemap if you would rather use the WP native way than a plugin.
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Display post lists in 2nd paragraph
- Submitting form to PHP
- How can I see $post object in frontend from functions.php?
- How to wrap image tag into div for post only?
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- How can i change an image’s author?
- post expire after x days
- HELP: Integrating WP with raw PHP code once published button is hit
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- New Plugin: Post update pushes a copy as a revision
- Showing Co-Authors on post page
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- bulk change of image setting “link to” to “link to: image url “
- Display a text message if the field is not found and not if found
- How do you remove plugin edit option?
- Scope for PHP Variables Assigned in functions.php or a plugin
- Override the filter from plugin in child theme
- How to get post URL in the_content filter?
- Add a plugin before main container
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- Custom Taxonomy Tag Search
- Missing argument 3 for wp_register_sidebar_widget()
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- add_query_arg not working
- WooCommerce get_price returning wrong price when used via ajax
- Open Post Thumbnail in New Child Theme File in WordPress
- Shortcode button dosent work for all posts. Work for first post only
- Accessing post’s meta data based on user’s click of a post
- Executing my function once on a specific time
- How to stop or remove an action being called inside a function of an extended class
- How to Display a Plugin function (content) on frontpage using index.php
- The problem with WordPress Importer
- How do I “get the next 10 posts after post_id == x”?
- wordpress plugin is not activating from widget
- Theme my Login plugin, how to update fields
- Edit Yoast SEO breadcrumbs output [closed]
- Date calculations from 2 custom fields
- How to enable specific plugin only based around shop manager role?
- Need to replace Currency Shortforms
- wp_enqueue_scripts
- Return multiple values in a shortcode attribute
- get specific value of a array | PHP
- How to get specific string/value from an array? php [closed]
- Shortcode Attributes to Return different $_POST
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Attempting to list all product categories and the price range of all products within them
- Allow a particular user to access a particular plugin?
- Newbie problem with adding include wp_footer
- WP Function does not trigger on Webhook API Call
- Cookie value changes back to previous value after changing
- WordPress is redirecting me to homepage
- Unpublished Pages Failing To Appear On Custom Path
- Creating an array from form inputs before it is posted to the options database
- Post source link plugin – small modification
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Share my WordPress plugin for updating how?
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- WordPress hide post from custom post-type on a single page
- How can I find related learndash course id from woocommerce product object?
- adding dynamic/multiple slug values in ‘option_none_value’
- How to create algorithm for ordering posts in WordPress?
- Adding discount functionality to the cart
- How to assign a specific service to a specific provider based on location
- Precheck fields when I add a new post
- Rename a folder via HTML POST request
- Conditional Homepage for logged in user
- How to get a post views count using ‘WordPress popular posts’ plugin
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- Get Shortcode output to database for static post_content
- working code, not working – Plugin Dev
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- Block plugin update possibilities (but not by hiding notifications)
- How much PHP and MySQL or MariaDB knowledge should I know to start writing WordPress themes and plug-ins and whatever else a beginner can edit?
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- post id or permalink auto-incrementing number and reset everyday
- Change Jobs for WordPress templates
- Change custom rewrite rule when permalink is updated/changed
- Failed to load resource: the server responded with a status of 500 () post.php
- How to echo a PHP Code After the Content
- Is admin section completely customizable in terms of styling?
- Return function results within shortcode
- Configuring default woo commerce login with modal popup
- How to make the first letter of a post title uppercase, in a plugin?
- Compare Ajax Data Results
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Soflyy WP All Import Custom File Download Issue
- register_activation_hook doesn’t fire at all
- Update (a function) post’s featured image as soon as $image_url changes
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Nested DIV’s across functions in PHP, do not seem to work
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- Populate select option with JSON file
- Every time I use wp_get_current_user() my plugin breaks