• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

My Monkey Do

A Log of Coding Solutions

  • Home
  • Web Hosts
  • Tools
  • About

debug

Notice: wp_enqueue_style was called incorrectly

June 18, 2020 by Webhead

Problem

Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information

Solution

This notice is not very helpful in tracking down the actual code causing the problem. Most solutions suggest deactivating all your plugins and switching to the default theme and then slowly reactivate each one until you find the problem. Who has time for that? Just install the Query Monitor plugin. Once the error shows go to the PHP Errors tab, expand the Location section and you’ll get a trace on the calling plugin. In my case this was the Slimbox plugin which fortunately I wasn’t using.

Filed Under: Coding Tagged With: debug, wordpress

WordPress 4.6 crashed my site

September 2, 2016 by Webhead

Fatal error: Cannot redeclare the_post_thumbnail_caption() (previously declared in ….

This error occurs because the_post_thumbnail_caption is a new function in WordPress 4.6.  However, people have been using this function for over 5 years now.  How?  Stackoverflow and other WordPress forums are flooded with questions asking how they can print out the thumbnail caption.  Since this wasn’t a built-in function before, the answer was to make your own function which was appropriately named the_post_thumbnail_caption.

Many theme authors, myself included, are now guilty of simply copy-pasting this function without adding their own theme prefix.  To avoid errors like this, functions within a theme should be prefixed with something unique to the theme like “mymonkeytheme_the_post_thumbnail_caption”.

If you have this error, contact your theme author and ask them to fix the theme.

 

Filed Under: Coding Tagged With: debug, wordpress

WordPress only displays “error”

June 25, 2013 by Webhead

In trying to copy over a theme and partially start over I ran into an issue where WordPress wouldn’t show anything but one word, error.  Well, that’s helpful.  Searching the wordpress forums I found that the problem is actually a security measure from Better WP Security.  Since my newly copied/created theme had so many missing files (404 errors) it blocked me out.  Deactivating that plugin (programmatically) caused the issue to go away.

Source:  http://wordpress.org/support/topic/getting-one-word-error-when-logging-into-wp-loginphp

Filed Under: Coding Tagged With: debug, wordpress

Google font WOFF in Firefox

February 8, 2013 by Webhead

Problem

In a website that gets fonts from Google’s CDN, the browser window loading icon continuously runs.  In Firebug you can see that the WOFF file from google is the culprit.

 

Solution

Turn off Firebug.  Apparently it’s a problem with Firefox/firebug that causes this issue.  Once you turn off firebug the website loads and no loading icon is shown.  The issue may be related to this, but not sure:  http://code.google.com/p/fbug/issues/detail?id=4649

 

keywords: google woff firefox error

Filed Under: Coding Tagged With: debug, firebug, firefox, google

WordPress Widget Image Field

September 19, 2012 by Webhead

I found a great utility plugin to help with adding a Image picker field to a widget.  Basically you install and activate this plugin and you make your own widget and utilize the image field easily.
The only problem I had was that it didn’t work in Firefox.  I found a simple error on line 72 in the scripts.js file.  Instead of calling events.target.href it should be e.target.href because e is the parameter passed in.

 

how to use: http://mondaybynoon.com/20120206/wordpress-widget-image-field/

Filed Under: Coding Tagged With: debug, javascript, wordpress

WordPress “The plugin generated xxxx characters of unexpected output during activation”

September 11, 2012 by Webhead

Problem

I was developing a plugin for wordpress and receive a messsage:

The plugin generated 496 characters of unexpected output during activation

Solution

I placed the following code at the end of my plugin file,

update_option(‘plugin_error’,  ob_get_contents());

then looked in the wordpress options table using the query

“SELECT *
FROM `wp_options`
WHERE option_name = ‘plugin_error'”

Then I could see what the unexpected output was.

Or I could’ve installed the WH Debug plugin and just added this to the end of the plugin file:

wh_debug( ‘plugin_error’, ob_get_contents());

And then viewed it in the WordPress admin pages under Tools->WH Debug.

 

source: http://hungrycoder.xenexbd.com/wordpress-2/how-i-have-solved-the-the-plugin-generated-xxxx-characters-of-unexpected-output-during-activation-problem.html

keywords: wordpress characters of unexpected output during activation

 

Filed Under: Coding Tagged With: debug, mysql, php, wordpress

  • Go to page 1
  • Go to page 2
  • Go to Next Page »

Primary Sidebar

Topics

apache apple block editor chrome cms css debug eCommerce embed firebug firefox git gmail goDaddy google hosting htaccess html html 5 IE crap image iPad iPhone javascript jquery linux localization mac os x ms sql mysql open source optimize php php 5.3 responsive rest api seo svg tinymce woocommerce wordpress wpengine xss yii youtube




Categories

  • Coding
  • Off the Shelf
  • Plugins
  • Random Thoughts
  • Server Stuff
  • Tools