This might be a stupid question. But I thought to ask it here.

It is really bad changing core file and I know that there are actions and filters in WordPress. But there are some limitations.

So why WordPress Core Functions Not Using function_exists()? I mean something like below example in core files.

    function wp_insert_post( $postarr, $wp_error = false ) {

        //Core Code


Then give a way to run PHP file before core files. So any developer can modify the core files without changing core files.

  • Are you trying to modify a certain core behavior?
    – birgire
    Commented Jul 17, 2017 at 11:52
  • @birgire No, I just asked it because I was wondering to know why WordPress team does not allow that feature and I got a answer from Rarst. Thanks :-) Commented Jul 17, 2017 at 12:10

1 Answer 1


Some do, a number of core functions is specifically designated pluggable and contained in pluggable.php for exactly this purpose.

It is also quite a messy approach and is often regretted it’s a thing at all.

The problems are loosely:

  • the replacement works exactly once;
  • letting extensions mess with core definitions can lead to very volatile results.

The problem with letting developers modify core files is often not how to allow this, but how to make it unnecessary. The latter is much more reasonable approach and basis for WP’s strong extensibility and success of its hooks API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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