开发者

Can i use query_posts in metabox?

Do you know if it's possible to use query_posts() inside a meta开发者_开发问答box.

I've tried everything, but can't seem to reset the query properly.

Cheers,

S.


It is, but you should not. Use get_posts() instead. It is same but does not affect main loop. From wp codex:

The query_posts function is intended to be used to modify the main page Loop only. It is not intended as a means to create secondary Loops on the page. If you want to create separate Loops outside of the main one, you should use get_posts() instead. Use of query_posts on Loops other than the main one can result in your main Loop becoming incorrect and possibly displaying things that you were not expecting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜