Skip to content

'Expected next thing to be escaping function, found "!"' in ternary condition #677

@dingo-d

Description

@dingo-d

I need a bit of clarification on this one. I have, in my theme, an input field for a breadcrumbs title that I can set in my page metabox, and I am outputting it like this

<?php echo ( ! empty( $my_bc_title ) ) ? wp_kses( $my_bc_title, allowed_tags() ) : get_the_title(); ?>

The allowed_tags() is just a function with allowed tags array. Now, the issue is probably in the fact that after echo everything should be sanitized, but I'm just checking if the variable is empty, and then basically sanitize it with wp_kses(), and get_the_title() function should be safe.

Also what If I sanitize it beforehand with esc_html(), when pulling it out of post custom field?

Should I ignore these kind of errors or?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions