WordPress.org

Ready to get started?Download WordPress

Forums

Media Library Assistant
[resolved] Auto Assign with Code (3 posts)

  1. likemindsdesigns
    Member
    Posted 1 year ago #

    I have another plugin that uses the Media Library to upload ads. If I can figure where to put the hack, what would be a good way to "auto-assign" any media it uploads to a certain ATT category "banner ads"?

    http://wordpress.org/extend/plugins/media-library-assistant/

  2. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for this question and for the related suggestion in the Reviews section.

    Since you say "with Code" and "where to put the hack" it sounds like you're comfortable with adding some PHP code to your theme, the ad-upload plugin or a plugin of your own. If that's true, you can hook the WordPress add_attachment action or the wp_update_attachment_metadata filter. These are called late in the process of uploading an attachment and are the hooks MLA uses to do its IPTC/EXIF and custom field mapping.

    You'll have to figure out a way to know that the item being uploaded is a banner ad, of course. Without knowing which plugin you use for that I can't say how you'd do that.

    In MLA, the file that contains the hooks is class-mla-options.php, and the data update is in class-mla-data.php. If all you want to do is add a term to the attachment_category taxonomy, your code can be quite a bit simpler.

    Let me know of I'm on the right track or if you had something else in mind. Thanks again for your interest in the plugin.

  3. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    It has been quite a while since your first post. I hope the suggestions I gave on which WordPress filters to hook were helpful and you've found a solution to your needs.

    I'm going to mark this issue resolved for now. Please fell free to re-open it if you have any problems with the plugin or further questions on this topic. Thanks for your interest.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.