Error While Activating A New WordPress Plugin - wordpress

I m learning to develop plugin and I am getting error on activation saying
The plugin generated 157 characters of unexpected output during
activation. If you notice “headers already sent” messages, problems
with syndication feeds or other issues, try deactivating or removing
this plugin.
I tried removing and making a new one but same error. here is my code (basic PHP comment to start a plugin, nothing fancy).
/*
Plugin Name: Awesomeness
Plugin URI: http://www.example.com/
Author URI: http://www.example.com/
Author: abc
Description: Just a fun plugin
*/
function fubs(){
error.log("this is working");
}
register_activation_hook(__FILE__,'fubs');
There is no white space before or ending on PHP code.

error is an undefined constant in your PHP code. You try to mix JavaScript with PHP, so PHP prints an error message.
Solution: Use PHP code in PHP and JavaScript code in JavaScript.

Related

Wordpress - Visual Editor Broken

I'm having a real nightmare trying to debug an issue on a Wordpress Woocommerce website. At some point the Visual Editor tab on the classic editor on both pages and Woocommerce Products has stopped working. I've tried all the obvious fixes including the following:
Deactivating all plugins and switching to Twenty Twenty Theme
Checking profile setting 'disable visual editor' is unchecked (have also tried checking/unchecking)
Adding the line define('CONCATENATE_SCRIPTS', false ); to wp-config
Reuploading the tinymce folder to the wp-includes/js directory
Reinstalling Wordpress
Installing the Advanced Tiny MCE plugin
In the browser console it shows the following error:
Uncaught SyntaxError: Invalid or unexpected token
post.php?post=23835&action=edit:2429 Uncaught ReferenceError: tinyMCEPreInit is not defined
at post.php?post=23835&action=edit:2429
at post.php?post=23835&action=edit:2437
2post.php?post=23835&action=edit:2392 Uncaught ReferenceError: tinyMCEPreInit is not defined
at HTMLDocument.initialize (post.php?post=23835&action=edit:2392)
8editor.min.js?ver=5.8.2:2 Uncaught TypeError: Cannot read properties of undefined (reading 'mceInit')
at n (editor.min.js?ver=5.8.2:2)
at HTMLDocument.<anonymous> (editor.min.js?ver=5.8.2:2)
at C (tinymce.min.js?ver=49110-20201110:2)
at HTMLDocument.d (tinymce.min.js?ver=49110-20201110:2)
Any further help would be greatly appreciated.

Uncaught Twig_Error_Syntax: Unexpected token "operator" of value ">"

Im developing my wordpress theme in a docker environment using timber / twig for my templating.
When i hosted my theme on a testwebsite i got the following 'fatal error'!
<b>Fatal error</b>: Uncaught Twig_Error_Syntax: Unexpected token "operator" of value ">". in blabla/templates/single.twig:32
Talking about the following code:
<p>
<strong>Tags:</strong> {{ post.tags|map(t => t.name)|join(', ') }}
</p>
I know I can rewrite the code and it will work without using the |map filter but thats not the point here ;-)
Stuck with the same problem. Somehow WP does not show me that update for timber plugin is available. Seems like timber team reverted plugin version and i didn't get the update(some problems with WPML compatibility).
Manually uploaded plugin v 1.9.5 (minimum required to understand arrow functions)
So this is what i found out..
By using the Timber plugin i have no saying in what twig version i get. So i deactivated my current timber plugin, downloaded it again and checked what i got..
Turned out it included an older version on twig. :(
Updated the twig version in my local env. Uploaded that. And now it works :(
Timber in WP repo has older version of Twig and always will. If you want to have the lates you should use Composer.
https://timber.github.io/docs/v2/installation/
Btw if you want to know Twig version try this
{{ constant('Twig_Environment::VERSION') }}

Can't access WP-Admin page because of error

I am trying to edit a website I made in Wordpress, but when I go to the example.com/wp-admin/ to get to the Admin,
I get the errors, and so there is no way to go into Wordpress to edit the site.
I even changed the WP Theme back to the default TwentyTen through PHPMyAdmin, but that didn't help.
What can I do? Here is what I get when I try to go to wp-admin page:
Notice: register_uninstall_hook was called incorrectly. Only a static
class method or function can be used in an uninstall hook. Please see
Debugging in WordPress for more information. (This message was added
in version 3.1.) in
/home/content/80/13163980/html/ybk/wp-includes/functions.php on line
3547
Notice: Undefined index: page in
/home/content/80/13163980/html/ybk/wp-content/themes/rt_infuse_wp/functions.php
on line 45
Notice: Undefined index: page in
/home/content/80/13163980/html/ybk/wp-content/themes/rt_infuse_wp/functions.php
on line 55
Warning: Cannot modify header information - headers already sent by
(output started at
/home/content/80/13163980/html/ybk/wp-includes/functions.php:3547) in
/home/content/80/13163980/html/ybk/wp-includes/pluggable.php on line
1178
I just set WP_DEBUG mode to false and that skipped it all and got me to the WP-Admin login page.
Just find the pluggable.php and after <?php please add this ob_start(); and save. That should work.
Warning: Cannot modify header information - headers already sent by
Removing "blank lines" from function.php file and check it now issue is as it is than after check plugin folder >> disable plugin and check
Refresh your Browser, and the original error message Should go away.

ReactJS / WP Picard theme error

Hi I am currently learning and experimenting with the ReactJS / WP theme by Jack Lenox https://github.com/Automattic/Picard I when I have installed it is not displaying the posts & the Console is displaying this message Uncaught TypeError: Cannot read property 'hasClass' of null
Anyone help? Thanks heaps :)
I solved 'Fatal error: Class 'WP_JSON_Comments' not found in .../functions.php line 163' this error by downloading wp-rest plugin from wordpress plugin center, current Version is 1.2.4.https://wordpress.org/plugins/json-rest-api/
Current picard is using wp-rest V1, wp-rest v2 still in beta. refer to: https://github.com/Automattic/Picard/issues/43
Also I updated my wordpress to 4.4.1

Updating Theme Framework Getting privileges Error

I have just Install New woocommerce theme Mystile Version 1.2.9. while using it i am getting error like:
"Warning: Invalid argument supplied for foreach() in D:\wamp\www\tramawoo\wp-content\themes\mystile\functions\admin-functions.php on line 3193"
On some forum i read that i have to upgrade Mystile Theme Framework to "WooFramework update is available (v5.5.5)". to get rid from this error.
So from Dashboard >> Mystile Theme > Theme Options >> when i click on WooFramework update is available (v5.5.5) i get this message.
"You do not have sufficient permissions to access this page."
I am logged in as ADMIN and also i am on my local-server WAMP.
Please suggest.
Thanks
This could be a bug in the theme or in the framework. It's hard to diagnose from afar. I would suggest that you manually download the new version and just replace it manually.

Resources