In wp settings, the post output is /%category%/%postname%.html

Using the function the_permalink or get_permalink I get a link to the post without taking into account the rubric. Moreover, if you log in to the admin panel and go to the site, then the functions issue a link based on the rubric.

I use the functions inside the loop below.

  $posts = get_posts(array( 'numberposts' => 15, 'category' => 5, 'orderby' => 'post_date', 'order' => 'DESC', 'exclude' => '5300', )); foreach ($posts as $post) { setup_postdata($post); the_permalink(); } 
  • The story is entertaining. The question is where? - SeVlad
  • @SeVlad Apparently from the code inside the foreach loop. On the home page. If you are logged in, the links are of the form site.by/category/post If in incognito mode (not authorized) then site.by/post is Dmitriy

0