Title: Custom menu widget programatically via xml-rpc
Last modified: August 20, 2016

---

# Custom menu widget programatically via xml-rpc

 *  Resolved [bigwolk](https://wordpress.org/support/users/bigwolk/)
 * (@bigwolk)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-menu-widget-programatically-via-xml-rpc/)
 * Hi, I’m trying to register custom menu widget using xml-rpc calls (it’s possible
   with [Extended api ](http://wordpress.org/extend/plugins/extended-xml-rpc-api/)
   plugin). I’m using [wp_register_sidebar_widget](https://codex.wordpress.org/Function_Reference/wp_register_sidebar_widget)
   function but it seems to do nothing. I call it with those parameters:
 *     ```
       wp_register_sidebar_widget(
           'custom_menu_widget-1',
           'My name',
           'WP_Nav_Menu_Widget',
           array( 'description' => 'blogroll' )
       );
       ```
   
 * I suspect 3rd parameter (‘WP_Nav_Menu_Widget’) may be wrong, but I can’t find
   anywhere what should be output callback for standard custom menu widget. I can’t
   and I don’t want to edit function.php on the site. I wan’t to register standard
   custom menu widget to enable it in a sidebar. Maybe there is another way to achieve
   this? Could anyone help me with that?

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-menu-widget-programatically-via-xml-rpc/#post-3556249)
 * The callback needs to be a function you’ve defined that displays the widget by
   outputting html. I’m not familiar with using this function, it appears to be 
   an outdated method. I suggest you read [Widgets API](http://codex.wordpress.org/Widgets_API)
   and the linked resources at the end. Then attack the problem again from this 
   new angle. Good luck!
 *  Thread Starter [bigwolk](https://wordpress.org/support/users/bigwolk/)
 * (@bigwolk)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/custom-menu-widget-programatically-via-xml-rpc/#post-3556324)
 * HI bcworkz, thanks for your reply. I didn`t found any signs that this is outdated
   method. The codex said only that this is new version of register_sidebar_widget.
   But You have right with this new angle. I resolved this problem in this way:
 *     ```
       $nav_name = 'Menu name';
       $nav_menu_id = wp_create_nav_menu($nav_name);
       $registered_widgets = get_option('wiget_nav_menu');
       $registered_widgets[] = array('title'=>'widget title', 'nav_menu'=>$nav_menu_id);
       update_option('widget_nav_menu',$registered_widgets);
       ```
   
 * This creates widget which we can enable in sidebar. Cheers.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/custom-menu-widget-programatically-via-xml-rpc/#post-3556327)
 * Yes, nothing anywhere says it is outdated. However, it does create a single use
   widget, which is an outdated mode. There are functions in core that upgrade single
   use to multi use, causing me to view single use as outdated. That is why I said
   it _appeared_ outdated. I’m not saying it is deprecated or obsolete. Maybe outdated
   wasn’t the best choice of words. Old Fashioned?
 * I hope that explains things better. I’m pleased things are resolved to your satisfaction.

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

The topic ‘Custom menu widget programatically via xml-rpc’ is closed to new replies.

## Tags

 * [register](https://wordpress.org/support/topic-tag/register/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/custom-menu-widget-programatically-via-xml-rpc/#post-3556327)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
