Title: Error in shortcodes.php
Last modified: April 3, 2017

---

# Error in shortcodes.php

 *  [kahana82](https://wordpress.org/support/users/kahana82/)
 * (@kahana82)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/error-in-shortcodes-php/)
 * I tried using the services shortcode [ap-services] and encountered the following
   problems:
 * 1) it is wrongly referenced in the plugin information as [ap-service] (the “s”
   is missing at the end)
 * 2) an error on line 14 of the file: ./wp-content/plugins/accesspress-custom-post-
   type/inc/frontend/shortcodes.php
    The argument passed to the foreach() loop is
   invalid. I solved this by enclosing the foreach loop in an if statement to test
   if the $service_atts variable is a valid array. Like this:
 *     ```
       if (is_array($service_atts)) {
       	foreach( $service_atts as $key=>$value ){
       	...
       	}
       }
       ```
   
 * The same can be done for the other shortcodes for custom post types…
    Please 
   update de plugin.
    -  This topic was modified 9 years, 2 months ago by [kahana82](https://wordpress.org/support/users/kahana82/).

Viewing 1 replies (of 1 total)

 *  [shanehaden](https://wordpress.org/support/users/shanehaden/)
 * (@shanehaden)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/error-in-shortcodes-php/#post-9036964)
 * Hi there,
 * Thank you for your suggestion.
 * We will consider your advice in the next update.
 * Thank you!!

Viewing 1 replies (of 1 total)

The topic ‘Error in shortcodes.php’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/accesspress-custom-post-type_71c2ac.
   svg)
 * [AccessPress Custom Post Type](https://wordpress.org/plugins/accesspress-custom-post-type/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/accesspress-custom-post-type/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/accesspress-custom-post-type/)
 * [Active Topics](https://wordpress.org/support/plugin/accesspress-custom-post-type/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/accesspress-custom-post-type/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/accesspress-custom-post-type/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [kahana82](https://wordpress.org/support/users/kahana82/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/error-in-shortcodes-php/)
 * Status: not resolved