WordPress.org

Ready to get started?Download WordPress

Forums

How to write a plugin that can override core files? (8 posts)

  1. sharris203
    Member
    Posted 4 years ago #

    I have modified a few WordPress core files, and was wondering how to create a plugin, which contains these files, that will override the core files when activated?

  2. MichaelH
    Member
    Posted 4 years ago #

    You will want to get acquainted with the Plugin_API.

  3. esmi
    Forum Moderator
    Posted 4 years ago #

  4. MichaelH
    Member
    Posted 4 years ago #

    Dup topic deleted ;)

  5. sharris203
    Member
    Posted 4 years ago #

    (yep, dupe. thanks, i switched categories)

    I've checked out the plugin API, but have never written a plugin and know limited php. Can anyone give me a hint in the right direction?

  6. MichaelH
    Member
    Posted 4 years ago #

    You might want to consider what part of core you are 'replacing' and then ask here or join the wp-hackers email list and ask there. Also look at the WordPress plugin repository to see how plugins similar to what you want to accomplish do things.

  7. sharris203
    Member
    Posted 4 years ago #

    These are my core edits:

    Remove "Allow Trackbacks and Pingbacks" option on Edit Pages:
    File: /wp-admin/includes/meta-boxes.php
    Commented out/deleted Line 379
    
    Remove "Allow Pings" on admin Quick Edit menu:
    File: /wp-admin/includes/template.php
    Commented out/deleted lines 1193-1196
    
    Unregister widgets from the widget pool:
    File: /wp-includes/default-widgets.php
    Commented out various lines within 1015-1037
    and change some widget descriptions
    
    Only show "Upload" option for "Add New Themes":
    File: /wp-admin/theme-install.php
    Line 29: $tabs['upload'] = __('Upload');
    Commented out lines 30-36

    As far as CSS, I've come up with this so far:

    add_action('admin_print_styles-edit-pages.php','the_function');
    
    // Then the_function would be something like...
    function the_function() {
    ?>
    <style type="text/css">
    // Hide "Allow Trackbacks and Pingbacks" & "Allow Pings" code,
    // and hide other code
    </style>
    <?php
    }
  8. sharris203
    Member
    Posted 4 years ago #

    oh well, i'll just overwrite core files.

Topic Closed

This topic has been closed to new replies.

About this Topic