正在尝试获取适用于自定义帖子类型的自定义管理链接。我已经设法添加了一个链接,在通常的“all”、“Published”、“Trash”等旁边显示所有“粘性”帖子,但实际的查询并没有像我希望的那样工作。
在pre\\u get\\u posts中,我试图修改查询以执行以下操作:-仅显示粘性帖子-尊重posts\\u per\\u页面和分页设置
如果我尝试这样做:
$query->set(\'post__in\', get_option(\'sticky_posts\'));
$query->set(\'posts_per_page\', 5);
。。。我看到了所有粘帖,但没有分页。设置“posts\\uu in”是否意味着忽略每页的posts\\u?
谢谢你的信息。放弃了“每页帖子数”,但这并没有什么不同。我的调试栏显示:
SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (2382,2358,2334,2331,2301,2298,2280,2262,2220,2226,2193,2157,2163,2136,2130,2109,2100,2084,2072,2026,2020,1961,1934,1846,1834,1756,1738,1709,1688,1552,1543,1498,1488,1482,1476,1438,1432,1412,1406,1400,1394,1391,1388,1358,1340,1319,1285,1282,1269,1227,1212,2621,2674,2659,3300,3313,3414,3560,3314) AND wp_posts.post_type = \'ad_listing\' AND (wp_posts.post_status = \'publish\') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC