Title: Error cloning WP widgets
Last modified: August 21, 2016

---

# Error cloning WP widgets

 *  Resolved [jasoncfoster](https://wordpress.org/support/users/jasoncfoster/)
 * (@jasoncfoster)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/error-cloning-wp-widgets/)
 * I’m getting the following error when attempting to clone a WP widget. We do have
   Widget Logic plugin installed and have tested deactivating before attempting 
   clone to no avail. We will be deleting that plugin once we’ve migrated everything
   over to your plugin.
 * [02-May-2014 20:34:36 UTC] PHP Fatal error: Class ” not found in D:\Playground\
   PlaygroundWebMatrix\FAL\wp-content\plugins\widget-wrangler\admin\admin-clone.
   php on line 69
 * Windows 8.1, WebMatrix 3.0
    PHP Version 5.4.24 MySQL Version 5.5.36 WordPress
   Version 3.9 Genesis Framework 2.0.2 Widget Wrangler 2.0.4
 * [https://wordpress.org/plugins/widget-wrangler/](https://wordpress.org/plugins/widget-wrangler/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * (@daggerhart)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/error-cloning-wp-widgets/#post-4875662)
 * Hi jasoncfoster,
 * Is the widget you’re trying to clone provided by a specific plugin or theme I
   could test? I agree with your test that the widget-logic plugin is not likely
   at fault.
 *  Thread Starter [jasoncfoster](https://wordpress.org/support/users/jasoncfoster/)
 * (@jasoncfoster)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/error-cloning-wp-widgets/#post-4875805)
 * Thanks for the quick response and sorry for late reply…
 * It was a custom widget created as a custom plugin. It’s very possible that the
   plugin was not constructed correctly which could wreak all sorts of havoc on 
   your code.
 * Go ahead and close this as we’ve determined we really want to start from scratch
   on those widgets instead of carrying over any original custom stuff.
 *  [Tim](https://wordpress.org/support/users/tkaufmann/)
 * (@tkaufmann)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/error-cloning-wp-widgets/#post-4875906)
 * I just ran into the same problem. I think it concerns widgets registered without
   a base id.
 *  [Tim](https://wordpress.org/support/users/tkaufmann/)
 * (@tkaufmann)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/error-cloning-wp-widgets/#post-4875907)
 * Nope, adding a base id didn’t help either.
 * Here’s my code:
 * [http://pastebin.com/KuWgydmJ](http://pastebin.com/KuWgydmJ)
 *  Plugin Author [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * (@daggerhart)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/error-cloning-wp-widgets/#post-4875908)
 * Hi tkaufmann,
    I haven’t tested your code, but looking at it I could see some
   issues. Your widget relies on contextual information about the current post being
   viewed. `global $post;` I recommend you make sure the post you have accessed 
   is of a specific type.
 * For example, if you were only showing it on posts or pages:
 *     ```
       public function widget( $args, $instance ) {
               error_log("fofo");
               global $post;
   
               if ( isset( $post->post_type ) && $post->post_type == 'post' || $post->post_type == 'page') {
                 $parent_page = jw_linkcat_get_top_parent_page_id($post->ID);
   
                 // ...
   
                 wp_list_bookmarks('category_name=' . $rightColAreaName . '&categorize=0&orderby=rating&title_li=' . $rightColHeadline);
              }
           }
       ```
   
 * Otherwise, you may not have a valid context for all your custom functions, and
   that could cause errors. For example, if you were to preview that widget on the
   widget edit screen, the global $post context would be the widget you are currently
   editing.
 * I don’t know if that will solve your problem, but let me know if it doesn’t and
   I’ll try your code.
 * Thanks,
    Jonathan

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Error cloning WP widgets’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/widget-wrangler_efbca2.svg)
 * [Widget Wrangler](https://wordpress.org/plugins/widget-wrangler/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-wrangler/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-wrangler/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-wrangler/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-wrangler/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-wrangler/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/error-cloning-wp-widgets/#post-4875908)
 * Status: resolved