can we add add_action(‘admin_init’,’myfunction’) in wp-includes/functions.php

I have a question regarding add_action, can i able to add add_action in functions.php that is wp-includes/functions.php

add_action('admin_init','myfunction');

Related posts

Leave a Reply

2 comments

  1. You can, but you should not since all your modifications will be overwritten when you upgrade wordpress. Use your theme’s functions.php instead.

  2. Don’t put it in wp-includes for the reasons rrikesh states. You’re just going to the code on update.

    If you have a lot of themes within which you want common functionality, make them children of a parent theme.

    The parent can hold all the common code in its own functions.php file and the children will be able to use it.

    Review the codex for information on Child Themes and how to implement them.