简体   繁体   English

如何在WordPress中控制GUID网址

[英]how to control guid url in wordpress

My title is kadhal-rojave-roja-2 but the guid id is http://sample.com/kadhal-rojave-roja-2/ . 我的标题是kadhal-rojave-roja-2,但GUID ID是http://sample.com/kadhal-rojave-roja-2/ I need it without dashes, like this: 我需要它没有破折号,像这样:

http://sample.com/kadhal rojave roja 2/

How to do it? 怎么做?

This is my post code: 这是我的邮政编码:

  $new_post = array(
      'ID' => '',
      'post_author' => $user->ID, 

      'post_excerpt' => $excerpt,
      'post_title' => $post_title,
      'post_status' => 'publish',

    );
$post_id = wp_insert_post($new_post);

This isn't possible, a browser will encode the spaces as %20 instead even if you do find a way to do this. 这是不可能的,即使您确实找到一种方法,浏览器也会将空格编码为%20。 Google also recommends using underscores or hyphens instead of spaces and so it is much better for search engine optimisation. Google还建议使用下划线或连字符代替空格,因此对于搜索引擎优化而言要好得多。

Also a URL could be much longer if you use %20 as it is 3 characters rather than 1. 另外,如果您使用%20,则URL可能会更长,因为它是3个字符而不是1个字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM