Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

useEntityRecords by TAXONOMY does nothing #14

Open
carstingaxion opened this issue Oct 8, 2023 · 2 comments
Open

useEntityRecords by TAXONOMY does nothing #14

carstingaxion opened this issue Oct 8, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@carstingaxion
Copy link
Member

The query doesn't respect the given taxonomy.

const labelsRequest = useEntityRecords( 'postType', 'wp_block', {
	status: "publish",
	wp_pattern_category: [ 227 ] // does nothing ????
} );
/**
 * Reduce queried lists of 'wp_block' posts to only labels, based on the existence of the '_label_printing' post_meta.
 *
 * This is needed because the query doesn't respect the given taxonomy.
 *
 * So we do this manually.
 *
 * CAN BE REMOVED WHEN # IS CLOSED.
 *
 * @todo #...
 *
 * @returns
 */
const getOnlyLabels = () => {
	return labelsRequest?.records?.filter((page) => Object.prototype.toString.call(page.meta._label_printing) !== '[object Array]' );
}
@carstingaxion carstingaxion added the bug Something isn't working label Oct 8, 2023
@carstingaxion
Copy link
Member Author

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant