Skip to content

Flag 'exclude' args in get_posts() #369

@rebeccahum

Description

@rebeccahum

What problem would the enhancement address for VIP?

Since WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn checks for post__not_in, we should also check for the 'exclude' parameter being passed into get_posts() which in turn calls post__not_in.

Describe the solution you'd like

What code should be reported as a violation?

get_posts( [ 'exclude' => $post_ids ] ); // Warning.

What could should not be reported as a violation?

$exclude = [ 1, 2, 3 ];

Additional context

Codex: https://developer.wordpress.org/reference/functions/get_posts/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions