You have created your own theme or your own plugin and would take to take advantage of WP/LR Sync to making everything even better. If you need something specific, or more information, don’t hesitate to ask on the WordPress forums, here.


The WP/LR Sync API is represented in purple below. It is a set of functions that you can call, but also a set of WordPress actions you can hook into.

WP/LR Infrastructure

There is also an undocumented API available through the WordPress REST API, under /wplr/v1 (if the user has enabled it in the settings). It’s fairly easy to use, and if you are a developer making mobile apps, for example, you should have no problem making requests on it.


There are two global variables you should be aware of.

global $wplr;
global $wplr_version;

The first one will give you access to the functions. With the second one, you will be able to retrieve the version number of the currently running version of WP/LR Sync.

Typically, a plugin or a theme willing to take advantage of WP/LR Sync will use the get_hierarchy function and the get_media_from_collection functions.


  • get_hierarchy(): retrieves the whole hierarchy of LR folders and LR collections.
  • get_keywords_hierarchy(): retrieves the whole hierarchy of LR keywords.

Media entries

  • get_media_from_collection( $lrCollectionId ): retrieve all the Media entries (IDs) for a LR collection.
  • get_media_from_tag( $lrTagId ): retrieve all the Media entries (IDs) for a LR keyword.


  • get_collection( $lrCollectionId ): retrieve information about a specific LR collection
  • get_collections_from_folder( $lrfolderId ): retrieve all the LR collections (IDs) available in the specified LR folder.
  • get_collections_from_media( $mediaId ): retrieve all the LR collections (IDs) a Media entry is attached to.


There aren’t many functions for tags yet. If you need something specific, don’t hesitate to add a feature request here.

  • get_tags_from_media( $mediaId ): retrieve all the LR keywords (IDs) attached to a specific Media entry.


There are many other functions, but it is not recommended to use them as they should only be used for internal operations.

  • get_sync_info( $mediaId ): get sync information for a Media entry. If the Media entry is synchronized with LR, you will also get the lrId, which is the ID of the image in Lightroom.


If you would like to hook on events happening within WP/LR Sync, you can use the WordPress actions. The relatively famous WP/LR Theme Assistant is built only on those actions.

Media entries

  • wplr_add_media ⇢ $mediaId
  • wplr_update_media ⇢ $mediaId, $collectionIds
  • wplr_remove_media ⇢ $mediaId
  • wplr_add_media_to_collection ⇢ $mediaId, $collectionId, $reOrder = false
  • wplr_remove_media_from_collection ⇢ $mediaId, $collectionId, $reOrder = false

Collections & Folders

  • wplr_create_collection ⇢ $collectionId, $inFolderId, $collection
  • wplr_update_collection ⇢ $collectionId, $collection
  • wplr_move_collection ⇢ $collectionId, $folderId, $previousFolderId
  • wplr_remove_collection ⇢ $collectionId


  • wplr_create_folder ⇢ $folderId, $inFolderId, $folder
  • wplr_update_folder ⇢ $folderId, $folder
  • wplr_move_folder ⇢ $folderId, $inFolderId, $previousFolderId
  • wplr_remove_folder ⇢ $folderId


  • wplr_add_tag ⇢ $tagId, $name, $parentId
  • wplr_update_tag ⇢ $tagId, $name, $parentId
  • wplr_remove_tag ⇢ $tagId
  • wplr_add_media_tag ⇢ $mediaId, $tag
  • wplr_remove_media_tag ⇢ $mediaId, $tag


  • wplr_order_collection ⇢ $mediaIds, $collectionId
  • wplr_reset
  • wplr_clean


There aren’t many filters in WP/LR Sync as, basically, its data shouldn’t be modified by other processes. But… there is one 🙂

  • wplr_calculate_pHash ⇢ null, $path

This filter allows you to bypass the very slow process of calculating the perceptual hash normally performed by WP/LR Sync, when you are the Total Synchronization module. If you are a developer, you develop a different way to match files together. Since this filter is only used once, I can make it work a bit differently if you need. Don’t hesitate to contact me about it.