English 中文(简体)
Wordpress, List author and Exclude Admin
原标题:Wordpress, List Authors and Exclude Admin

我正试图通过作者在我的口头博客中发言,但有些犹豫不决,很可能是因为我没有完全掌握如何利用这些职能。 当我这样做时:

$authors = $wpdb->get_results( SELECT DISTINCT post_author FROM  .$wpdb->posts);
if($authors):
foreach($authors as $author):
if(the_author_meta( display_name , $author->post_author) !=  admin ): //my line

我试图将“行政”用户排除在我的住所之外,但在我执行时。 我在包括行政在内的一页上看到了所有作者的名字。 因此,条件不是有条件的,而是反应的。

我做了什么错误?

感谢

最佳回答

使用get_the_author_meta(),而不是_author_meta()。 作为该职能的一部分,你对浏览器重新使用对应结果。

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签