看起来你的代码就像写的一样。
或者,您可以使用生成字母数字字符串uniqid()...
<a href="http://meet.jit.si/<?php echo uniqid()?>" target="_blank"> click here </a>
<小时/>
EDIT: 根据其他信息修改了代码。
这将创建一个短代码,允许您通过添加[rand_jitsi_btn] 至帖子/页面:
// hook our shortcode creation to `init` so that WordPress has time to initialize properly
add_action( \'init\', \'add_custom_shortcode\' );
function add_custom_shortcode() {
add_shortcode( \'rand_jitsi_btn\', \'create_rand_jitsi_btn\' );
}
// Code to create the button
function create_rand_jitsi_btn() {
return \'<a href="http://meet.jit.si/\' . uniqid() . \'" target="_blank"> Launch Meeting </a>\';
}
我还没有测试过这段代码,但是如果你把它放在你孩子的主题中,它应该会起作用
functions.php 文件
注意:您可以使用random_int() 而不是uniqid() 如果需要随机数。