Pb with the sitemap wich shows up

0
Pb with the sitemap wich shows up 1
Nico73
Jul 26, 2022 03:52 PM 1 Answers
Member Since Jul 2022
Subscribed Subscribe Not subscribe
Flag(0)

Hello

i've got a problem withe the sitemap page which show up automaticaly in the related pages / article wich i do not want.

Pourquoi est-il important de réserver un moniteur de ski ?

How to settle that down ? Please.

BR

Nicolas

0 Subscribers
Submit Answer
Please login to submit answer.
1 Answers
Sort By:
Best Answer
0
Pb with the sitemap wich shows up 2
Azizul Raju
Jul 27, 2022
Flag(0)

Hi Nico73,
It's a little bit advance customization. But no worries! I'm here to guide you step by step.

First, go to Appearance => Theme File Editor and select the Theme Functions option from the right-hand side. Kindly follow the screenshot
https://i.imgur.com/VX44kbU.png

Now copy the code below, paste it at the bottom of the Theme Functions file, and update it. Screenshot: https://i.imgur.com/skQz8Rl.png

add_filter('related_post_query_args','related_post_query_args_20200126');
function related_post_query_args_20200126($args) {
$args['post__not_in'] = [123]; // excluded pos id
return $args;
}

Note: You have to replace the number 123 with the page ID you want to exclude! If you don't know how to find the page ID, then go to Pages => All Pages and try to edit the specific page that you want to remove. Now in the URL section, you can find your page ID. Just replace 123 with the page ID.
Screenshot one: https://i.imgur.com/rQQtblF.png
Screenshot two: https://i.imgur.com/oNJsuCW.png

Bonus! What if you want to exclude multiple pages?
It's simple! You can add multiple page IDs with comma-separated values.
Screenshot: https://i.imgur.com/R9bBXtl.png

Let us know the progress!

Sign in to Reply
Replying as Submit