WordPress: Fatal error: you cannot use the return value of a function in the context of the entry on line 130

I am trying to add this code to my head using the wp_head action,

But I get this error Fatal error: Can't use function return value in write context on line 130 line number 130 is onif ( !empty ( display_header_text() ) ) : ?>

Here is my code

<?php
129:function _display_header_text() {
130:if ( !empty ( display_header_text() ) ) : ?>
131:<style type="text/css" id="_display_header_text">
132:    .mainHeader a img {
133:        display:none;
134:    }
135:</style>
136:<?php endif; }
137:add_action('wp_head','_display_header_text');
138:?>
139:
140:<?php
141:function _is_admin_bar_showing() {
142: if( is_admin_bar_showing() ):?>
143:<style type="text/css" id="_is_admin_bar_showing">
144:    .fixedHeader {
145:        top:32px;
146:    }
147:</style>
148:<?php endif; }
149:add_action('wp_head','_is_admin_bar_showing');
150:?>

my this code works fine in localhost without any errors, but it sends an error on the real server.

any idea what is it? and how can i solve it?

+4
source share
1 answer

This line probably causes an error:

if ( !empty ( display_header_text() ) ) : ?>

The documentation forempty() states:

: PHP 5.5 empty() ; . , : empty(trim($name)). trim($name) == false.

+9

Source: https://habr.com/ru/post/1535044/


All Articles