I am developing a wordpress theme which will be sold out to users on some marketplace. I was finding a way to edit Wordpress widget.
And I found that and from here all the code is available in /wp-includes/default-widgets.php

If I only wanted to change the title then I will have surely passed a parameter in register_sidebar() before_title options but the problem is I don't want to only change the title but add images to the recent post (Without Plugin) which requires the modification of the code.

Now my question is 'What can be the downsides of editing the wordpress widget files directly?' Will the wordpress update overwrite it or the buyers of the theme will be safe?

  • 3
    Never modify core files - not only will WP updates overwrite those changes, but you also have no way of knowing what other themes and plugins may be modifying things. It is safer to either extend a widget (which copies it, but lets you modify the copy, so the end user will be able to choose between the core widget and your extended one) or at least unregister the core widget and register your own in its place. See wordpress.stackexchange.com/questions/33207/… – WebElaine Feb 13 at 19:16
  • Thanks for your reply WebElaine, I knew what I'm doing is not right for sure. Thats the reason I asked the question as I failed to find an answer like the link you posted. Thanks a lot ! :) – Muhammad Osama Feb 13 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.