• Resolved delikatesy

    (@delikatesy)


    I’ve got some post meta on my attachments so I can fill in Credit, Source etc.
    Not using ACF, just have a simple lightweight plugin to add these fields to my media library items.

    When I’ve checked out your plugin, I haven’t found a way how to bulk edit these. Can this plugin do this? If yes, how?

    thanks
    Viktor

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your question. You can use MLA to automatically populate post meta (Custom) fields from a variety of data sources if you want to, or you can add custom fields to the Media/Assistant admin submenu table and the Quick Edit and Bulk Edit areas.

    For your application (without adding mapping rules to automatically populate the fields) you can follow these steps:

    1. Navigate to the Settings/Media Library Assistant “Custom Fields” tab.
    2. Scroll down to the “Add New Custom Field Rule” section on the left-hand side of the page.
    3. Select the name of the custom field you want to edit in the “Name” dropdown.
    4. Leave the Data Source dropdown at the “None (select a value)” default.
    5. Leave the Meta/Template text box empty.
    6. Check the “MLA Column” box.
    7. Check the “Quick Edit” box, if you like.
    8. Check the “Bulk Edit” box to add the field to the Bulk Edit area.
    9. Leave the default values in the remaining controls.
    10. Click “Add Rule” to create the new rule.

    That should get you started on the solution you want. I am marking this topic resolved, but please update it if you have any problems or further questions regarding the above process. Thanks for your interest in the plugin.

    Thread Starter delikatesy

    (@delikatesy)

    Hello David,

    I’ve actually checked this all already. The problem is, the Name dropdown doesn’t feature my post meta values. Therefore I cannot do anything with it.

    My custom post meta for attachments is created with this code

    
    	$form_fields["uss_source_name"] = array(
    		"label" => __("Source", 'twentyseventeen' ),
    		"input" => "text", // this is default if "input" is omitted
    		"value" => esc_attr( get_post_meta($post->ID, "_uss_source_name", true) ),
    		"helps" => __("The source of the image.", 'twentyseventeen' ),
    	);
    	
    	// Add a Credit field
    	$form_fields["uss_source_url"] = array(
    		"label" => __("Source URL", 'twentyseventeen' ),
    		"input" => "text", // this is default if "input" is omitted
    		"value" => esc_url( get_post_meta($post->ID, "_uss_source_url", true) ),
    		"helps" => __("The source URL link.", 'twentyseventeen' ),
    	);
    	
    	// Add a Credit field
    	$form_fields["uss_license_name"] = array(
    		"label" => __("License", 'twentyseventeen'),
    		"input" => "text", // this is default if "input" is omitted
    		"value" => esc_attr( get_post_meta($post->ID, "_uss_license_name", true) ),
    		"helps" => __("Type of the license.", 'twentyseventeen'),
    	);
    	
    	// Add a Credit field
    	$form_fields["uss_license_url"] = array(
    		"label" => __("License URL", 'twentyseventeen'),
    		"input" => "text", // this is default if "input" is omitted
    		"value" => esc_url( get_post_meta($post->ID, "_uss_license_url", true) ),
    		"helps" => __("The license URL link.", 'twentyseventeen'),
    	);	
    	

    thanks

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and for the sample code; very helpful.

    It looks like the problem is caused by your use of a leading underscore in the custom field name. The leading underscore is used by WordPress to denote “internal” values that should not be displayed in the UI. MLA respects this WordPress standard and does not show the values in the dropdown control.

    You can try clicking the “Enter new field” link under the “Name” dropdown and entering your field names manually. That’s working for me on my test system.

    I am traveling this week but I can have a closer look when I return home. Any further details you can provide will be useful.

    Thread Starter delikatesy

    (@delikatesy)

    Great, your solution worked like a charm.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Bulk editing custom post meta’ is closed to new replies.