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?
- Plugin update error message
- Keep one user logged for a year?
- Customizing subject in comment notification e-mails
- WP showing “warning: call_user_func_array()”, What to do?
- Update Multiple Post Meta for the Same Post In One call?
- Set a User as Author of all ‘New Posts’ posted
- Post source link plugin – small modification
- How to turn off email you receive when registered?
- Code in theme functions.php faster than with a plugin?
- 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
- bulk change of image setting “link to” to “link to: image url “
- How to get post URL in the_content filter?
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- 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
- Shortcode button dosent work for all posts. Work for first post only
- 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
- How do I “get the next 10 posts after post_id == x”?
- Theme my Login plugin, how to update fields
- Date calculations from 2 custom fields
- How to enable specific plugin only based around shop manager role?
- Adding a new field to the address field type in gravity forms
- Nested shortcode functions accessing variable
- All sites themes functions.php have been changed
- Customize permalink wordpress category id
- Load Javascript from Plugin in One Page Only?
- Checking the count within a foreach loop
- Help with WP Business Directory Manager Plugin?
- wp_dequeue_script for a Plugin
- Need to replace Currency Shortforms
- Return multiple values in a shortcode attribute
- get specific value of a array | PHP
- Woocommerce singe product custom gallery output works just on the first slide
- How to translate wordpress error message
- Api external with wordpress
- Creating an admin meta box to save post as pending
- Different registration form for different roles
- More gentle way to hook WordPress custom url
- WordPress Stats Plugin: Display Post Views [closed]
- Can you echo PHP code from a variable?
- Removing the custom_image_header from wp_head
- WP Insert Post If user refreshes override new post
- Code for unique user visit count on every page WordPress
- woocommerce remove coupon link does not work
- need to find duplicated meta value in custom filed and view the posts that have the same value
- how to validate input field in wordpress generated with wpform plugin
- add_rewrite_rule to load different page, without changing URL in browser
- implement custom roles in custom plugin
- How to get current cart values using WC_Shortcodes?
- WordPress is redirecting me to homepage
- Share my WordPress plugin for updating how?
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- 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
- 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
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- 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
- Configuring default woo commerce login with modal popup
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- register_activation_hook doesn’t fire at all
- Nested DIV’s across functions in PHP, do not seem to work
- My ajax request don´t work and return 0
- 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
- Find all strings between an enclosing shortcode
- Create csv file in plugin
- How to copy data from user profile page (profile.php) to theme customizer
- Posting code inside the post instead of in the template file using shortcode
- Metabox Data not saving
- Including a PHP file via a function that is part of a plugin?
- How to disable register and reset the password from WordPress admin panel?
- How to tweak a plugin without preventing it from updating
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Notifications Bar on home page only
- Adding a script & php to functions.php
- PHP Creating a formula from mysql db values and db stored math operator
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- WordPress Convert queries to slashes using function.php
- How to change all the urls of the WordPress site?
- I want to allow certain file types on dokan upload files