• Resolved David Lingren

    (@dglingren)


    I am working on a new support topic regarding the combination of our plugins. I’ve linked to the topic in the “Link to the page you need help with:” text box. Any thoughts?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Let’s discuss about this in private ??

    Thread Starter David Lingren

    (@dglingren)

    I am happy to report that I had a very productive dialog with Derek, the MLA user reporting the ALT Text problem, and have found the problem’s cause and a solution. The solution requires a small change in your WP/LR Sync plugin.

    After a long series of logging and debugging exchanges with Derek (during which I discovered and fixed a couple of MLA bugs; yea!) we determined that the MLA mapping rules were running flawlessly when WP/LR Sync processed its WP REST API calls to synchronize items between WordPress and Lightroom. The problem Derek reported is specific to the ALT Text field.

    I then dug in to the WP/LR Sync 3.3.3 source code (lrsync_core.php) and discovered this interesting bit of code around line 855 in the sync_media_add function:

            require_once( ABSPATH . 'wp-admin/includes/image.php' );
             $attach_data = wp_generate_attachment_metadata( $wp_id, $newpath );
             wp_update_attachment_metadata( $wp_id, $attach_data );
    
             // Create Alt Text
             update_post_meta( $wp_id, '_wp_attachment_image_alt', $lrinfo->lr_alt_text );
    
             // Support for WP Retina 2x
    

    MLA adds its mapping logic to the wp_update_attachment_metadata logic. It looks like WP/LR Sync overwrites the ALT Text value after that logic does its work. I applied a simple fix by re-arranging the code to apply your update just before the metadata update call:

            // Create Alt Text
             update_post_meta( $wp_id, '_wp_attachment_image_alt', $lrinfo->lr_alt_text );
    
             require_once( ABSPATH . 'wp-admin/includes/image.php' );
             $attach_data = wp_generate_attachment_metadata( $wp_id, $newpath );
             wp_update_attachment_metadata( $wp_id, $attach_data );
    
             // Support for WP Retina 2x
    

    I sent Derek the updated plugin and he reports that it corrected the problem.

    I don’t see any negative consequences of applying this fix to your official code. Would you add this fix to your next release?

    Let me know what you think and I will update my support topic regarding this issue. Thanks!

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @dglingren and as usual thanks a lot for your great help, as always ?? I still have to reply to you by email, but for now, here it is: the new release of WP/LR Sync (3.3.4) with the fix included. I hope it will help everyone ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘MLA + WP/LR Sync update/mapping issue’ is closed to new replies.