Skip to content

Please consider unslashing the search term $s #240

@mjdewitt

Description

@mjdewitt

Is your feature request related to a problem? Please describe

I'm always frustrated when I can't search for quoted strings, i.e., mostly array index identifiers. For example, searching through my snippets for 'first_name' returns no results. Removing the quotes returns 25 results with the vast majority being false positives returning hits on the variable $first_name.

The issue seems to be the fact that the search term is escaped with slashes in class-list-table.php, function search callback. I haven't yet tested it with @line:, but it appears that the search term is handled the same way.

One more thing, I appreciate the simplicity for handling most searches by just typing some text. But there are times when a regex search would save a lot of time. Would you consider an option to use preg_match instead of strpos? Perhaps a new search option like @regex: ^[\b]code\bsnippets[\b]$

Mike

PS Shea, Hope all is well with you.

Describe the solution you'd like

Leave the search string as intended.

Describe alternatives you've considered

in class-list-table
function search_callback
line 1164: $s = wp_unslash($s);

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions