Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Support Steve M

    (@wpsmort)

    @makabe The ability to exclude posts by term ID will be in the next version due out next week. The next version will also include a new filter to do this as well – https://aioseo.com/docs/aioseo_sitemap_exclude_terms/

    Thread Starter Makabe

    (@makabe)

    Thanks. I’ll test it when a new version comes out.

    Thread Starter Makabe

    (@makabe)

    Hello,

    Do you have any news on this? When the new version will be available?

    Plugin Support Steve M

    (@wpsmort)

    @makabe This was released in the last version. You can use the example code here and change the value of $ids – https://aioseo.com/docs/aioseo_sitemap_exclude_terms/

    Thread Starter Makabe

    (@makabe)

    Unfortunately the code doesn’t work either.
    The posts from category ID 2285 are still visible in the sitemap.

    Plugin Support Steve M

    (@wpsmort)

    Hi @makabe, I’ve tested this myself and confirmed it works. You may have a cached sitemap so clear all caching including your browser cache.

    Thread Starter Makabe

    (@makabe)

    I know, but I only have problem with this one, specific category.
    Maybe it’s because I exclude it from WP Loop and WP Search?

    Plugin Support Steve M

    (@wpsmort)

    Hi @makabe, if it’s working for other terms but not working for one specific term then I’d say it’s got something to do with that specific term.

    Thread Starter Makabe

    (@makabe)

    Hi @wpsmort ,

    I tried everything (turned off all plugins and changed the theme) but still all posts from this category (ID 2285) cannot be excluded from sitemap…

    I’ve noticed that the problem also occurs with a few different categories. I suspect that it’s somehow related to the category ID. If in the database are posts with the same string in ID – this causes a problem. Maybe you could verify it somehow on your side?

    By the way, I found a small bug. A backup created in Tools / Import/Export cannot be deleted manually. When I click on the delete button nothing happens.

    Best,
    Adrian

    Plugin Support Steve M

    (@wpsmort)

    Hi @makabe, can you share the exact code you’re using and I can see if there’s anything amiss with it.

    Thanks for letting me know about that bug.

    Thread Starter Makabe

    (@makabe)

    Sure, I’m using this code:

    add_filter( 'aioseo_sitemap_exclude_terms', 'aioseo_sitemap_filter_excluded_terms', 10, 2 );
    
    function aioseo_sitemap_filter_excluded_terms( $ids, $type ) {
       if ( 'general' === $type ) {
          $ids[] = 2285;
       }
       return $ids;
    }

    Link to my post sitemap: https://gracz.org/post-sitemap.xml

    Before I used the code above: 424 URLs
    Number of posts to exclude from category “2285”: 85 URLs
    After I used the code above: 419 URLs (5 URLs are missing)

    As you can see after using the code above, posts from category “2285” are still visible in the sitemap, but 5 posts with this IDs have disappeared:
    22256, 22297, 22503, 22085, 21892 (all are from category “549”).

    Best,
    Adrian

    Plugin Support Steve M

    (@wpsmort)

    Hi @makabe, are any of those posts in multiple categories? If they are, then they will still show up in the sitemap. If you can contact me here I can get more info from you.

    Thread Starter Makabe

    (@makabe)

    Hi Steve,

    are any of those posts in multiple categories? If they are, then they will still show up in the sitemap.

    No, all posts from “2285” are only in this one specific category.

    Plugin Support Steve M

    (@wpsmort)

    Hi @makabe, Does this still happen if you deactivate all other plugins and switch to the default Twenty TwentyOne theme? I’m wondering if something is interfering with the ID that’s returned.

    Thread Starter Makabe

    (@makabe)

    Yes, of course. I tested it with default theme and all plugins turned off.
    Yesterday someone had the same problem, but his post was deleted.

    `blue2k wrote:

    Hi,

    We have the same issue. We want to exclude ALL posts from ine category, and it does not work. If we add term id it excludes posts which has partially the same id number, but it does not reflect the categories.

    Is there any thin we can do to exclude full category?

    Greetings!`

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Sitemap – Excluding all posts from one category doesn’t work’ is closed to new replies.