I am trying to create a list with related wp pages at the end of each article.
I am doing with with WP pages and not posts.
This is my code so far:
$related = get_pages(array(
'number' => 5,
'cat' => '1',
'sort_column' => 'date',
'sort_order' => 'desc',
'post_status' => 'publish',
'exclude_tree' => get_the_ID(),
));
"cat" or "category" isn't doing anything. This code just lists pages from all categories instead of only category "1".
How can I limit it to only category 1?
I have categories for pages because I've added this to functions:
register_taxonomy_for_object_type('category', 'page');
question from:
https://stackoverflow.com/questions/65924349/how-to-select-wp-page-category 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…