Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 下拉式Wordpress作者错误的永久链接|查询字符串_Php_Wordpress_Drop Down Menu_Query String_Author - Fatal编程技术网

Php 下拉式Wordpress作者错误的永久链接|查询字符串

Php 下拉式Wordpress作者错误的永久链接|查询字符串,php,wordpress,drop-down-menu,query-string,author,Php,Wordpress,Drop Down Menu,Query String,Author,我做了几个下拉搜索,但我和作者之间有问题 这是“我的档案”页面的网站: 因此,如果我搜索一位作者,它会将我发送到类似这样的位置: mydomain.com/?author=67 当它应该把我送到这里: mydomain.com/author/username 我尝试了很多方法,但它总是将查询字符串作为答案,并且永远无法让它消失 感谢您的帮助 <form action="<?php bloginfo('url'); ?>/author/" method="get">

我做了几个下拉搜索,但我和作者之间有问题

这是“我的档案”页面的网站:

因此,如果我搜索一位作者,它会将我发送到类似这样的位置:
mydomain.com/?author=67

当它应该把我送到这里: mydomain.com/author/username

我尝试了很多方法,但它总是将查询字符串作为答案,并且永远无法让它消失

感谢您的帮助

<form action="<?php bloginfo('url'); ?>/author/" method="get">
    <?php
    $args = array(
      'show_option_none' => __( 'Select Author' ),
        'name'             => 'author',
        'orderby'          => 'ASC',
        'echo'             => 0,
        'who'              => 'authors',
    );
    ?>
    <?php $select  = wp_dropdown_users( $args ); ?>
    <?php $replace = "<select$1 onchange='return this.form.submit()'>"; ?>
    <?php $select  = preg_replace( '#<select([^>]*)>#', $replace, $select ); ?>
    <?php echo $select; ?>
    <noscript>
        <input type="submit" value="View" />
    </noscript>
</form>

不幸的是,
wp\u下拉菜单用户($args)
函数没有设置名称值的选项。这是身份证,就这样

您应该使用
wp\u list\u authors($args)
,然后执行以下操作:

<?php $users = wp_list_authors($args); ?>


<select name="yourname" onchange='return this.form.submit()'>
  <?php foreach($users as $user):?>
    <?php //just check how to access the $user name url friendly tag ?>
    <option name="<?php echo $user->name; ?>"><?php echo $user->name?></option>
  <?php endforeach;?>
</select>


不幸的是,
wp\u下拉菜单\u users($args)
函数没有设置名称值的选项。这是身份证,就这样

您应该使用
wp\u list\u authors($args)
,然后执行以下操作:

<?php $users = wp_list_authors($args); ?>


<select name="yourname" onchange='return this.form.submit()'>
  <?php foreach($users as $user):?>
    <?php //just check how to access the $user name url friendly tag ?>
    <option name="<?php echo $user->name; ?>"><?php echo $user->name?></option>
  <?php endforeach;?>
</select>


不幸的是,
wp\u下拉菜单\u users($args)
函数没有设置名称值的选项。这是身份证,就这样

您应该使用
wp\u list\u authors($args)
,然后执行以下操作:

<?php $users = wp_list_authors($args); ?>


<select name="yourname" onchange='return this.form.submit()'>
  <?php foreach($users as $user):?>
    <?php //just check how to access the $user name url friendly tag ?>
    <option name="<?php echo $user->name; ?>"><?php echo $user->name?></option>
  <?php endforeach;?>
</select>


不幸的是,
wp\u下拉菜单\u users($args)
函数没有设置名称值的选项。这是身份证,就这样

您应该使用
wp\u list\u authors($args)
,然后执行以下操作:

<?php $users = wp_list_authors($args); ?>


<select name="yourname" onchange='return this.form.submit()'>
  <?php foreach($users as $user):?>
    <?php //just check how to access the $user name url friendly tag ?>
    <option name="<?php echo $user->name; ?>"><?php echo $user->name?></option>
  <?php endforeach;?>
</select>



谢谢我想我走对了。你的代码应该是$users没有用户正确吗?用户似乎正在显示并指向正确的url,但现在下拉列表消失了[您应该将
用户
替换为
$users
用户
替换为
$user
@Jupago您是对的,python错误地将$替换为$。至于select,没有更多的
echo$select
。只需将其作为普通html添加即可。@Jupago我的代码已更正。我在Jonathan提到的$user中犯了一些错误。请确保检查$user->name是否存在,如果没有,则获取ID为的作者的姓名。你实际上想要一段代码。还没有运气@AntoineRebel,但谢谢!查看WP reference tryint以了解如何检查用户是否存在。无法获得要显示的下拉选项和要删除的列表!我认为我的思路是正确的。你的代码应该是$users没有用户对吗?用户似乎正在显示并指向正确的url,但现在下拉列表消失了[您应该将
用户
替换为
$users
用户
替换为
$user
@Jupago您是对的,python错误地将$替换为$。至于select,没有更多的
echo$select
。只需将其作为普通html添加即可。@Jupago我的代码已更正。我在Jonathan提到的$user中犯了一些错误。请确保检查$user->name是否存在,如果没有,则获取ID为的作者的姓名。你实际上想要一段代码。还没有运气@AntoineRebel,但谢谢!查看WP reference tryint以了解如何检查用户是否存在。无法获得要显示的下拉选项和要删除的列表!我认为我的思路是正确的。你的代码应该是$users没有用户对吗?用户似乎正在显示并指向正确的url,但现在下拉列表消失了[您应该将
用户
替换为
$users
用户
替换为
$user
@Jupago您是对的,python错误地将$替换为$。至于select,没有更多的
echo$select
。只需将其作为普通html添加即可。@Jupago我的代码已更正。我在Jonathan提到的$user中犯了一些错误。请确保检查$user->name是否存在,如果没有,则获取ID为的作者的姓名。你实际上想要一段代码。还没有运气@AntoineRebel,但谢谢!查看WP reference tryint以了解如何检查用户是否存在。无法获得要显示的下拉选项和要删除的列表!我认为我的思路是正确的。你的代码应该是$users没有用户对吗?用户似乎正在显示并指向正确的url,但现在下拉列表消失了[您应该将
用户
替换为
$users
用户
替换为
$user
@Jupago您是对的,python错误地将$替换为$。至于select,没有更多的
echo$select
。只需将其作为普通html添加即可。@Jupago我的代码已更正。我在Jonathan提到的$user中犯了一些错误。请确保检查$user->name是否存在,如果不存在,则获取ID为的作者姓名。实际上,您想要的是其中的一部分。还没有运气@AntoineRebel,但谢谢!查看WP reference tryint以了解如何检查用户是否存在。无法显示下拉选项并删除列表