Title: Change slide links programatically
Last modified: August 29, 2017

---

# Change slide links programatically

 *  Resolved [bcanr2d2](https://wordpress.org/support/users/bcanr2d2/)
 * (@bcanr2d2)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/change-slide-links-programatically/)
 * The issue can be found here: [https://oneshc.staging.wpengine.com/](https://oneshc.staging.wpengine.com/)
   
   The preview works: Yes It works with other themes: Yes It works when I disable
   all other plugins: Haven’t Tried Meta Slider version: 3.4
 * I am wondering how I can dynamically change the link on a slide.
 * I am looking at the following page, to see if it is possible
    [https://www.metaslider.com/documentation/metaslider_type_slider_anchor_attributes/](https://www.metaslider.com/documentation/metaslider_type_slider_anchor_attributes/)
 * I am using a Nivo slider.
 * add_filter( ‘metaslider_nivo_slider_anchor_attributes’, ‘metaslider_change_lookup_link’,
   10, 4);
    function metaslider_change_lookup_link ($attributes, $slide, $slider_id){//
   Change the lookup link on slide 5286 to be dynamic if ($slide->ID == 5286) { //
   Get member type info $member_type = xprofile_get_field_data(‘Member Type’,bp_loggedin_user_id());
   If ($member_type == ‘A’ ){ Set link here to match this type } else { Set a different
   link }
 * }
    return $attributes; }
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fchange-slide-links-programatically%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [DNutbourne](https://wordpress.org/support/users/dnutbourne/)
 * (@dnutbourne)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/change-slide-links-programatically/#post-9451840)
 * Hi,
 * You will need something like the following:
 *     ```
       add_filter( ‘metaslider_nivo_slider_anchor_attributes’, ‘metaslider_change_lookup_link’, 10, 3);
       function metaslider_change_lookup_link ($attributes, $slide, $slider_id) {
       	//Change the lookup link on slide 5286 to be dynamic
       if ($slide->ID == 5286) {
       //Get member type info
       $member_type = xprofile_get_field_data(‘Member Type’,bp_loggedin_user_id());
       If ($member_type == ‘A’ ){
       	$attributes['href'] = 'http://example.com';
       } else {
       	$attributes['href'] = 'http://example.com';
       }
   
       }
       return $attributes;
       }
       ```
   
 *  Thread Starter [bcanr2d2](https://wordpress.org/support/users/bcanr2d2/)
 * (@bcanr2d2)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/change-slide-links-programatically/#post-9452607)
 * Perfect, thanks for that.
    Only thing is that instead of $slide->ID, I had to
   use $slide[“id”] to get the value from the array

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Change slide links programatically’ is closed to new replies.

 * ![](https://ps.w.org/ml-slider/assets/icon.svg?rev=2771717)
 * [Slider, Gallery, and Carousel by MetaSlider - Image Slider, Video Slider](https://wordpress.org/plugins/ml-slider/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ml-slider/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ml-slider/)
 * [Active Topics](https://wordpress.org/support/plugin/ml-slider/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ml-slider/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ml-slider/reviews/)

## Tags

 * [change link](https://wordpress.org/support/topic-tag/change-link/)
 * [nivo](https://wordpress.org/support/topic-tag/nivo/)

 * 2 replies
 * 2 participants
 * Last reply from: [bcanr2d2](https://wordpress.org/support/users/bcanr2d2/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/change-slide-links-programatically/#post-9452607)
 * Status: resolved