The MU forums have moved to WordPress.org

Hack File and wp_sitemeta to wp_options (5 posts)

  1. delayedinsanity
    Member
    Posted 14 years ago #

    Two quick questions;

    1) The 'Hack File' option in wp_#_options, I can't seem to find any information on what this is, or what it does. Can anybody enlighten me, or point me in the right direction?

    2) I suppose I could test this easily enough just by doing it, but since I'm posting the above question I figured I would add it here anyways - is it possible to override options in wp_sitemeta, such as 'upload_filetypes' and 'mu_media_buttons' by setting the same option in wp_#_options? Nope, doesn't seem to be that simple. Ah well.

  2. andrea_r
    Moderator
    Posted 14 years ago #

    1 - that was for the legacy my-hacks.php file (I think) which is being depreciated. It was a spot in single WP to put in your "hacks" and have them included.

  3. delayedinsanity
    Member
    Posted 14 years ago #

    Thanks Andrea, I'd heard of that hack file before, but wasn't sure if it was referring to the same thing or not. Clears that one up! As for number two, instead of starting a new thread, maybe I can ask more about that here...

    I dug around in the core files and found that I could use the upload_mimes filter, and media_buttons action to accomplish what I wanted, but I'm seeing some strange behavior I was hoping somebody here could clear up for me.

    I used a modified version of the original mu_media_buttons function to add my own code, and attempted to replace it via;

    remove_action('media_buttons', 'mu_media_buttons');
    add_action('media_buttons', 'k_media_buttons');

    Except that it doesn't work, the call to remove_action returns false. It adds my function properly, but it doesn't remove mu_media_buttons, so the buttons are displayed twice.

    The only thing I can think is that my mu-plugin file is being loaded before mu.php and therefore the action tagged with mu_media_buttons can't be removed, as technically it hasn't even been added yet.

    So how can I override this, so that my function takes precedence and is the only one used? :(

  4. dsader
    Member
    Posted 14 years ago #

    I'd use this in an mu-plugin:

    add_action('admin_head', create_function('', 'return remove_action( "media_buttons", "mu_media_buttons" );'));

  5. delayedinsanity
    Member
    Posted 14 years ago #

    Much appreciated, that worked like a charm and saves having to do even minor edits to the core files. I've been getting my hands dirty with whats actually going on inside of them quite a bit lately, but a lot still remains foggy. :)

About this Topic

  • Started 14 years ago by delayedinsanity
  • Latest reply from delayedinsanity