Answer the question
In order to leave comments, you need to log in
How to change the CNC GUID to readable?
The site currently displays a link like Site / ?page_id=146 because I was pulling out the link address the_permalink() in my case leads to the category page and not to the post.
Please tell me how to bring it into the form Website / ?/nashi-uslugi/asfaltirovanie/asfaltirovanie-dvorov/
<?
$stati_children = new WP_Query(array('post_type' => 'page', 'orderby' => [ 'meta_value_num'=>'DESC' ], 'post_parent' => 66 ) );
if($stati_children->have_posts()) :
while($stati_children->have_posts()): $stati_children->the_post(); ?>
<div class="block-uslug col-c-3 col-mc-3 col-t-2 col-m-2">
<div class="block-usluga">
<div class="uslugi">
<span class="title4"><? the_title() ?></span>
<p></p>
<? echo the_field('ikonka_svg'); ?>
<? $menyu_podkategorij = get_field('menyu_podkategorij');
if(!empty($menyu_podkategorij)) {
foreach ($menyu_podkategorij as $key => $value) { ?>
<a href="<? echo $value->guid; ?>" class="__link crop-text"><? echo $value->post_title; ?></a><br/>
<? }
}
?>
</div>
</div>
</div>
<? endwhile;
endif; wp_reset_query();
?>
WP_Post Object
(
[ID] => 146
[post_author] => 1
[post_date] => 2021-07-12 17:12:45
[post_date_gmt] => 2021-07-12 14:12:45
[post_content] =>
[post_title] => Асфальтирование дворов
[post_excerpt] =>
[post_status] => publish
[comment_status] => closed
[ping_status] => closed
[post_password] =>
[post_name] => asfaltirovanie-dvorov
[to_ping] =>
[pinged] =>
[post_modified] => 2021-07-23 11:36:03
[post_modified_gmt] => 2021-07-23 08:36:03
[post_content_filtered] =>
[post_parent] => 68
[guid] => https://asfalt.trade/?page_id=146
[menu_order] => 0
[post_type] => page
[post_mime_type] =>
[comment_count] => 0
[filter] => raw
)
Answer the question
In order to leave comments, you need to log in
guid is not used for this at all. This field is created once when a post is published to identify the entry in the RSS feed. RSS parsers use this field to determine whether they processed the entry or not.
The link structure is set in Settings → Permalinks. You can get a link by post id in a loop withget_permalink()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question