WordPress随机发布网址

我的自定义帖子需要通过简单的哈希值保护。我一直在谷歌搜索和堆栈溢出现在约4个小时, 但我似乎找不到正确的答案。

有没有办法更改为ID级的新帖子创建的子弹并将其哈希化?

因此, 除了:

wordpress.com/blog/143

散列id并将其作为url:

wordpress.com/blog/202cb962ac59075b964b07152d234b70

global $wp_rewrite;
$custom-posts_structure = '/custom-post/'. md5('%custom-post%');
$wp_rewrite->add_rewrite_tag("%custom-post%", '([a-z0-9]+)', "custom-post=");
$wp_rewrite->add_permastruct('custom-post', $custom-posts_structure, false);

我拼命尝试了上面的代码, 但这只会对字符串进行哈希处理, 而不会检索唯一的ID。


#1


有没有办法更改为新帖子创建的子弹

对于这一部分, 你应该挂钩到适当的位置-请参阅在Wordpress中自定义Post Slug的自动生成

基本上, 这只是将post_name替换为其他内容(你的哈希), 因此, 如果你使用基于帖子名称的默认路由, 则无需在重写设置本身中添加任何内容。

来源:

https://www.srcmini02.com/63805.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37569.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?