WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. macgamer
    Member
    Posted 1 year 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?

    http://wordpress.org/extend/plugins/jetpack/

  2. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    Hello!

    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

About this Topic

Tags

No tags yet.