800,000+ WordPress sites are already using MetaSlider!

Show a Slideshow via the WordPress API

There are two registered post types in MetaSlider (ml-slider and ml-slide). This means that you can use the following routes:

  • /wp-json/wp/v2/ml-slide
  • /wp-json/wp/v2/ml-slider

Before you can access the following routes, you will need to modify show_in_rest value to true. You can do this by adding the following code below to your functions.php:

You can create custom API endpoint. For example, you can get a list of images for specific slideshow using the following code snippet:

Another approach relies on the fact that MetaSlider uses a “ml-slider” taxonomy. You can use code like this snippet below. This code allows you to view the “ml-slides” for a given “ml-slider” by passing in it’s ID as a query parameter by calling wp-json/wp/v2/ml-slide?ml-slider=$ID. You can located theID for the slider’s slug by going to wp-json/wp/v2/ml-slider.

We hope that this code will be useful, but do not make guarantees. If you need troubleshooting help, or modifications to this code, please contact MetaSlider Pro support.