Skip to content

Wrong check for "is_numeric" resulting in faulty admin_filter #87

@Rayken

Description

@Rayken

Line 276 @ https://github.com/johnbillion/extended-cpts/blob/master/src/class-extended-cpt-admin.php#L276

Should probably not have !, because right now, if the key is numeric (like a post_id or so) it reverts to using the 'value' and that is really odd.

My use case is creating a dropdown with post_title and its ID as value, right now I'm getting post_title as value as well. Changing the line to:

if ( is_numeric( $k ) ) {

Fixes this issue. However, I do believe you could skip the entire foreach @ line 275-280 and changing line 288 to:

$key = ( is_numeric( $k ) ? $k : $v );

Unless I have misunderstood the use of $use_key. However this is causing issues for me atm!

For options I'm returning something like:

array( 1 => 'Some post', 2 => 'some other post', 3 => 'some third post' )

And the scripts thinks it should use "Some%20post" as filter instead of 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions