wordpress _e function
This is one one classic bug.
When PHP started your script, $wordscut is not defined. When you run
$wordscut .= "sometext";
The code actually do$wordscut = $wordscut . "sometext";
At this point, $wordscut is not available, thus Undefined Variable error occurred.To fix it, add
$wordscut = '';
beforefor($i=0; $i<count($info[0]); $i++) {
Wordpress how to use jquery and $ sign
By default when you enqueue jQuery in Wordpress you must use jQuery
, and $
is not used (this is for compatibility with other libraries).
Your solution of wrapping it in function
will work fine, or you can load jQuery some other way (but that's probably not a good idea in Wordpress).
If you must use document.ready
, you can actually pass $
into the function call:
jQuery(function ($) { ...
Warning: call_user_func_array() expects parameter 1 to be a valid callback
The reason why you are getting that warning is already mentioned in comments section by @LoicTheAztec. I will quote his comment here:
That is when a hooked function name doesn't match with the hookI will give some pointers on how to debug and resolve the issue. Since you mentioned that it happened all of a sudden and you have not done anything, I assume that it might be caused by a plugin. One of your plugin might be updated and the plugin developer might have made this mistake.
association… so for example when you haveadd_action('hook_name', 'function_name' );
and sofunction_name
doesn't match with any
declared function… This can happen when renaming a function, but not
renaming the function name in the hook association.
What you can do is, visit your WordPress Admin Dashboard --> Plugins page. Then deactivate each plugin one by one. Make sure you check after deactivating each plugin, so that you would be able to figure out which plugin is causing the issue. While you are deactivating the plugins, if the warning disappeared, you would be able to tell that the plugin that you just deactivated is the villain here.
Since you figured out the plugin causing the issue, check whether it has any updates available. If so, update that plugin and see if it resolves the issue. If no updates,
- you could try contacting the plugin developer, reporting the bug.
- or, you could try debugging and fixing the bug yourself (if you are comfortable with coding)
/wp-content/plugins/name_of_plugin
You can use the File Manager in your cPanel or use FTP, to access the files. On each file of that plugin, you have to search for add_action(
. And note down the second parameter, which would be callback function name. And search whether that function is defined somewhere. If not defined, then it could be mispelled. You have to find the mispelled function definition and change it's name to what is being used (as second parameter) of add_action()
This will resolve the issue. In other case, while you are deactivating the plugins one by one and the warning message never disappeared even after trying to deactivate all the plugins, then you need look at your theme files (location: /wp-content/themes/your_current_theme_name_here/
)
To search for the keywords within files, there's a good plugin called String Locator. I most often use it for debugging purposes. Might come in handy for you.
How to style text inside _e() wordpress function?
As per the WordPress standard you can not use the html tag inside the _e() function.
Here I have shared the WordPress official link for your reference:
URL: https://developer.wordpress.org/reference/functions/_e/
As you can see in this function 1st parameter is string $text and 2nd paramenter string $domain = 'default'.
Here I have shared the example of code which you can use.
echo '<p style="color:red;">' . __( 'Please enter a valid email address!', 'mytextdomain' ) . '</p>';
Related Topics
How to Select a MySQL Database to Use with Pdo in PHP
PHP MySQL - Insert into Without Using Column Names But with Autoincrement Field
Laravel Catch Eloquent "Unique" Field Error
Function to Add Dashes to Us Phone Number in PHP
How to Select Year and Month from the Created_At Attributes of Database Table in Laravel 5.1
PHP MySQL Pagination with Random Ordering
SQL Select * from Multiple Tables
PHP Looping Through Multiple Arrays
PHP MySQL Query Where X = $Variable
File_Get_Contents('Php://Input') Always Returns an Empty String
How to Require PHP Files Relatively (At Different Directory Levels)
How to Add 5 Minutes to Current Datetime on PHP < 5.3
When Should I Close a Database Connection in PHP
Include Just Files in Scandir Array