Jetpack by WordPress.com
Is there a "preferred" way to modify a jetpack url (2 posts)

  1. macgamer
    Posted 3 years ago #

    I know I can get a photon URL via wp_get_attachment_image_src. I can then add filters and so on by simply taking this URL and calling jetpack_photon_url with additional arguments, but I wanted to see if there was a more preferred/robust way to do this?


  2. Richard Archambault
    Happiness Engineer
    Plugin Contributor

    Posted 3 years ago #


    That should work! If you want to remove filters, remove_query_arg() can be used to strip off undesired filter parameters.

    Also, jetpack_photon_url() can be used independently of wp_get_attachment_image_src() if you have an image URL from somewhere, as jetpack_photon_url() has no dependency on WordPress’ image functions. As per the Terms of Service, you still need to connect Jetpack to WordPress.com if you were to do so.

    Also worth noting is that in this case, you'd likely want a if( function_exists() ) wrapped around your calls, so that wp_get_attachment_image_src() would degrade gracefully without Jetpack.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.