Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Too many single-use variables #386

Open
jdevalk opened this issue Dec 7, 2023 · 0 comments
Open

Too many single-use variables #386

jdevalk opened this issue Dec 7, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@jdevalk
Copy link
Collaborator

jdevalk commented Dec 7, 2023

This code:

$error = new WP_Error( '-2', 'The post ID was not set' );
wp_send_json_error( $error );

could be:

wp_send_json_error(
    new WP_Error( '-2', esc_html__( 'The post ID was not set', 'accessibility-checker' ) )
);

No setting variables when you don't need to, properly translating text strings, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant