Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8364227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:22:56+00:00 2026-06-09T12:22:56+00:00

I was using widget and found that it has hook widget_init. Like below and

  • 0

I was using widget and found that it has hook widget_init.
Like below and works well.

add_action('widgets_init', create_function('', 'return register_widget("example_widget");'));

But the hook is “wp_widgets_init”, so what’s the difference here? Which is better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:22:57+00:00Added an answer on June 9, 2026 at 12:22 pm

    Looking at the source of wp_widgets_init it looks like the wp_widgets_init initializes internal widgets first and then calls generic widgets_init. As such you’ll want to use the second one as you can relay on WP environment to be already setup.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Widget that I've created using a ContentPart. The ContentPart has
I am using AutoComplete widget. It works fine for two characters search but doesen't
Im using an existing widget from the jquery-ui labs call selectmenu. It has callback
My app already has a completed menu using jquery.menu.js found at http://wiki.jqueryui.com/Menu . I'm
Using MVC3 I have found that setting a SelectList's selected value correctly renders the
I am trying to make a custom Gallery widget. I found that I wanted
I have a fileUploader widget that I'm using to select an xml file. I
I need to create a rectangle in a Canvas widget using the background color
i deserialize a widget-hierarchy using gson, but have problems deserializing final fields. Example: public
Actually I created a button using the cobogw widget library. But the button does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.