Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am a complete WordPress noob, so please don't mind. I'm working on a project where developers tweaked the core WordPress code. My job is to extract whatever core functions they changed and put them somewhere else so that in the future when the WordPress version is upgraded it will be more maintainable.

I did some research and it looks like writing a plugin is the way to go. After reading this: https://codex.wordpress.org/Writing_a_Plugin , I'm under the assumption that WordPress will first look through all the functions in my plugins and if it finds one it won't default to the WordPress core version of the function? So is this equivalent to overriding the WordPress core functions?

So from the link I provided, it looks like plugins just require: 1. (by default, unless changed) storing them under wp-content/plugins/my_plugin_name 2. comments in the head of the PHP file stating the plugin details.

So in this case, can I just make a single file wp-content/plugins/my_plugin_name/my_plugin_name.php with all the customized core functions inside of it? Do I not to add any include "my_plugin_name" ? It just loads automatically?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I'm under the assumption that WordPress will first look through all the functions in my plugins and if it finds one it won't default to the WordPress core version of the function?

No. Not counting any pluggable functions that might be added by a theme or plugin, the only functions that you can overwrite in that way-- by simply writing a function of your own having the same name-- are the ones in pluggable.php or pluggable-deprecated.php but relying on the latter would be unwise. Try it with any other functions and you will get a fatal PHP error.

If any other function have been changed you are going to have to try to duplicate the functionality of the Core hacks by means of actions and filters and that could be a long hard road.

I should also note that WordPress is no longer adding new pluggable functions to that pluggable.php file.

Reference

http://codex.wordpress.org/Pluggable_Functions

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.