!empty($title) returns 1 when $title is empty
-
Working on revamping a site and discovered a strange quirk.
In the widget function code, there is a line that says:
function widget( $args, $instance ) { extract($args); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance ); echo $before_widget; if ( !empty( $title ) ) { echo $before_title . '[' . $title . '] ' . !empty( $title ) . $after_title; } ?> <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div> <?php echo $after_widget; }
The Boolean at the
!empty($title)
is supposed to pass a 0 if the $title has no value, but for some reason, it returns a 1. I have looked in the database and everything and can not ascertain what is the challenge.(I added the brackets to test the issue)
Any ideas friends? I do have PHP Text Widget installed, but it is using the stock textwidget codebase.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘!empty($title) returns 1 when $title is empty’ is closed to new replies.