How to Make a PHP Variable Return Text Instead of Nothing

129
June 01, 2021, at 7:10 PM

My code needs to see and use the text held in a variable:

I'm working on a WordPress plugin. One section of it needs to place text above the website's login form. If I just type in text as in the code below (return "My New Header Text";) it works fine and "My New Header Text" appears above the form.

// Add a CUSTOM MESSAGE to the top of the WordPress login form
function new_plugin_login_message( $message ) {
    if ( empty($message) ){
        return "My New Header Text";
    } else {
        return $message;
    }
}
add_filter( 'login_message', 'new_plugin_login_message' );

But when I use a variable that includes the text, as in: (return "$MyNewMessage";) it won't work. Below is what I have. Even with lots of experimentation and Googling, I can't find a way for it to actually take the text stored in the variable and place it above the form. How do I make it see and use the text that is in the variable, "$MyNewMessage"?

// Add a CUSTOM MESSAGE to the top of the WordPress login form
function new_plugin_login_message( $message ) {
    if ( empty($message) ){
        return "$MyNewMessage";
    } else {
        return $message;
    }
}
add_filter( 'login_message', 'new_plugin_login_message' );

This must be easy, but it eludes me. Thanks for any assistance.

Rent Charter Buses Company
READ ALSO
500 Error code with “Internal server Error” message, while doing POST method using MVVM and API in android application

500 Error code with “Internal server Error” message, while doing POST method using MVVM and API in android application

For API confirmation, I have tried in POSTMAN app, But response is getting properly and the data has been inserted successfullyBelow is the result of POSTMAN

144
How do I get the value of useState from component A to component B

How do I get the value of useState from component A to component B

I'm relatively new to JS and React as a whole, I delved into React and started making some projects with Django backendI have a list of items in the ProductList component in react,

87
Node application crashes due to mysql error 'PROTOCOL_PACKETS_OUT_OF_ORDER'

Node application crashes due to mysql error 'PROTOCOL_PACKETS_OUT_OF_ORDER'

I am running a nodejs application (web service using express) on RHEL v8, using node v16

159