Skip to main content
5 votes

How to generate/update a XML sitemap without plugins?

The following code works right off the bat. Your sitemap will show up on: https://your-website-name.com/sitemap.xml Every time you create or update a page, post or custom post type it will show. ...
epicrato's user avatar
  • 201
4 votes
Accepted

Add custom URLs to WordPress's XML sitemap

Sitemap Provider It's possible to create a so called custom sitemap provider and register it with wp_register_sitemap_provider(). It's helpful to look at the core setup, e.g. for the WP_Sitemaps_Posts ...
birgire's user avatar
  • 67.6k
4 votes

Exclude custom post_type in sitemap generation?

If you are using functions.php script to register custom post type, you should declare false to 'has_archive' => true,. function custom_post_type() { $labels = array( ... ); $args = array( ...
iMarkDesigns's user avatar
2 votes

Where do upload sitemap.xml in WordPress?

The root of your site is where the wp-admin, wp-content and wp-includes folder is. From what you are showing in the image this does not appear to be the actual root directory of your Wordpress ...
Fencer04's user avatar
  • 459
2 votes

get_permalink executes link without https

this may be called as a bug in get_permalink, but it may not be. I had the same case, and when I tried to echo site_url(); I get the https://... But once I updated the options for siteurl and home to ...
prosti's user avatar
  • 4,313
2 votes

Exclude custom post_type in sitemap generation?

If you need a filter solution: add_filter( 'wpseo_sitemap_exclude_post_type', 'your_prefix_exclude_cpt_from_sitemap', 10, 2 ); function your_prefix_exclude_cpt_from_sitemap( $value, $post_type ) { ...
Brandon's user avatar
  • 21
2 votes

Exclude custom post_type in sitemap generation?

This question has been asked a long time ago, but the answer is kind of simple: Go to SEO --> Search Appearance. Select tab Contenttypes. Scroll down, here you can display or hide custom post types ...
H. Rensenbrink's user avatar
2 votes

Create a sitemap without a plugin - get parent pages only?

You have to slightly modify your query on your above code as: $postsForSitemap = get_posts( array( 'numberposts' => -1, 'orderby' => 'rand', 'post_type' => ...
Aishan's user avatar
  • 762
2 votes
Accepted

Where is All in One SEO Pack sitemap.xml located?

The sitemap added by most of the plugins (such as Google sitemaps or YOAST SEO pack) is a virtual file added to your websites by the plugin. This file doesn't physically exist, therefore modifying it ...
Johansson's user avatar
  • 15.3k
2 votes
Accepted

When does the Yoast SEO filter hook wpseo_sitemap_urlimages fire?

What I wanted to say in my previous comment: This hook is only fired when the sitemap is being built. After that, it's cached and always served from cache. That means you'll never see any change on ...
swissspidy's user avatar
  • 3,884
2 votes
Accepted

I need help locating a URL that is on my site map, but that I can't find in my Wordpress dashboard

Keep in mind there's really only a few actual pages in WordPress. Most URLs are getting redirected to index.php, parsed for the request information, and then processed accordingly. They are mostly ...
tmdesigned's user avatar
  • 1,675
2 votes
Accepted

Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args

The error happens because the filter callback (shapeSpace_disable_sitemap_post_meta()) expects to receive two parameters ($args and $post_type) and yet you call add_filter() without setting the fourth ...
Sally CJ's user avatar
  • 39.6k
2 votes

Exclude a specific page from Wordpress sitemap. (wp-sitemap.xml)

The code below does work, just make sure you are editing the correct themes function.php file! // Remove specific pages function gt_disable_sitemap_specific_page($args, $post_type) { if ('page' !== $...
Mikeys4u's user avatar
  • 129
2 votes
Accepted

Part of Menu Item Hidden on Header Menu

It's because you're skewing the parent container with CSS transforms. You can see in this screen capture of developer tools that the parent cuts off the content on the second row. Try this: .menu-...
Tony Djukic's user avatar
  • 2,204
2 votes
Accepted

How to include empty terms into wp-sitemap.xml?

Use the wp_sitemaps_taxonomies_query_args hook to set hide_empty to false: add_filter( 'wp_sitemaps_taxonomies_query_args', function ( $args ) { $args['hide_empty'] = false; ...
Wongjn's user avatar
  • 276
1 vote

How to get post ID after removing that post?

There's only one way I can see that you can get the ID after a post is deleted. If you're using wp_delete_post to delete posts, you add a after_delete_post action hook where you will then do the other ...
ray-happyforms's user avatar
1 vote

Embed sitemap in a page

You can fetch all the different post_types you have by using get_post_types(). Then you can loop through all posts of each post_types and echo all these posts (title + link). That way you have the ...
DeltaG's user avatar
  • 899
1 vote

How to insert a sitemap within a subsite when using Wordpress multisite

Sitemaps belong to a domain. Not sure if there is any special code that lets you extend the main site's sitemap, but you can always use the sitemao directive in robots.txt "file" of your ...
Mark Kaplun's user avatar
  • 23.5k
1 vote

I need help locating a URL that is on my site map, but that I can't find in my Wordpress dashboard

I had a similar issue with LearnPress plugin. In this case the plugin took over the "courses" slug, even when it already existed, and changed it to "courses-2". Even after uninstalling LearnPress, I ...
ldrrzkn's user avatar
  • 11
1 vote
Accepted

Where to put robot.txt and sitemap.xml for wordpress installed in its own directory

You can safely place your robot.txt file as well as the sitemap.xml file into your websites root directory and NOT the WordPress directory. When a robot visits your site, the first place it checks ...
Shawn W's user avatar
  • 226
1 vote
Accepted

Does the 'WordPress Order' feature, within the WordPress Dashboard, have any impact on site architecture?

Short answer: No, it does not have any impact at all. Longer answer: The 'Order' field is a remnant from the early days of WordPress. Its only purpose is to order the pages in the admin for easier ...
swissspidy's user avatar
  • 3,884
1 vote

Disable parent in wp_list_pages - Wordpress

You can use get_pages() instead and write some custom code like this : $args = array('exclude' => '5', 'sort_column' => 'ID' ) $pages = get_pages($args); foreach ( $pages ...
Temani Afif's user avatar
1 vote

Where is All in One SEO Pack sitemap.xml located?

hm.. isn't you suppose to run find command in other way? sudo find / -iname sitemap* note for / <- that stands for root directory. P.S. Isn't there easier just to check web root of your website ...
Oleg Butuzov's user avatar
  • 3,214
1 vote

"No sitemap linked in your robots.txt file"

Well, that message is pretty self explanatory. There is no sitemap linked in your robots.txt file. So you check if you have a sitemap (if not install a plugin that will generate one for you) and add ...
cjbj's user avatar
  • 14.8k
1 vote

Where do upload sitemap.xml in WordPress?

Difference between Site Root and WordPress Root It's important to differentiate between both variants. The Root of your Domain/Website depends on the settings of your webhost. Some might give you ftp ...
Helmi's user avatar
  • 118
1 vote

Uploading sitemap.xml

WordPress is set up in a way that mostly ignores existing files. If what you want is literally upload fixed sitemap.xml file you can just do that and upload it to the root of your site (using FTP, ...
Rarst's user avatar
  • 99.8k
1 vote

Is it safe to use 'date_default_timezone_set' in plugin file?

Currently, the built-in function current_time() expects function date_default_timezone_set() is never used. Inspecting the code of current_time() confirmed this, because that function formats the ...
Marco Marsala's user avatar
1 vote

How to generate/update a XML sitemap without plugins?

Wordpress has an XML sitemap feature built in since 5.5 that you can customize. See this blog post for more details and some quick examples. Take a look here to see a list of hooks you can use to ...
Talk Nerdy To Me's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible