protected function getWPContents($type = 'posts', $multiple = false, $options = [], $post_id = 0, $value = '')
    {
        // Access WordPress contents
        $wpcontents = [];

        // Exclude current item
        if (isset($options['exclude']) && 'current' === $options['exclude']) {
            $options['exclude'] = $post;
        }

        // Get asked contents
        $authorized = [
            'categories', 'category',
            'menus', 'menu',
            'pages', 'page',
            'posts', 'post',
            'posttypes', 'posttype',
            'tags', 'tag',
            'taxonomies', 'taxonomy',
            'terms', 'term'
        ];

        // Check contents
        if (!in_array($type, $authorized)) {
            return [];
        }

        // Data retrieved
        if (in_array($type, ['categories', 'category'])) {
            $wptype = 'Categories';
        } else if (in_array($type, ['menus', 'menu'])) {
            $wptype = 'Menus';
        } else if (in_array($type, ['pages', 'page'])) {
            $wptype = 'Pages';
        } else if (in_array($type, ['posts', 'post'])) {
            $wptype = 'Posts';
        } else if (in_array($type, ['posttypes', 'posttype'])) {
            $wptype = 'Posttypes';
        } else if (in_array($type, ['tags', 'tag'])) {
            $wptype = 'Tags';
        } else if (in_array($type, ['taxonomies', 'taxonomy'])) {
            $wptype = 'Taxonomies';
        } else {
            $wptype = 'Terms';
        }

        // Get contents
        $function = 'getWP'.$wptype;
        $wpcontents = $this->$function($options, $value);

        // Return value
        return $wpcontents;
    }
protected function getWPContents($type = 'posts', $multiple = false, $options = [], $post_id = 0, $value = '')
    {
        // Access WordPress contents
        $wpcontents = [];

        // Exclude current item
        if (isset($options['exclude']) && 'current' === $options['exclude']) {
            $options['exclude'] = $post;
        }

        // Get asked contents
        $authorized = [
            'categories', 'category',
            'menus', 'menu',
            'pages', 'page',
            'posts', 'post',
            'posttypes', 'posttype',
            'tags', 'tag',
            'taxonomies', 'taxonomy',
            'terms', 'term'
        ];

        // Check contents
        if (!in_array($type, $authorized)) {
            return [];
        }

        // Data retrieved
        if (in_array($type, ['categories', 'category'])) {
            $wptype = 'Categories';
        } else if (in_array($type, ['menus', 'menu'])) {
            $wptype = 'Menus';
        } else if (in_array($type, ['pages', 'page'])) {
            $wptype = 'Pages';
        } else if (in_array($type, ['posts', 'post'])) {
            $wptype = 'Posts';
        } else if (in_array($type, ['posttypes', 'posttype'])) {
            $wptype = 'Posttypes';
        } else if (in_array($type, ['tags', 'tag'])) {
            $wptype = 'Tags';
        } else if (in_array($type, ['taxonomies', 'taxonomy'])) {
            $wptype = 'Taxonomies';
        } else {
            $wptype = 'Terms';
        }

        // Get contents
        $function = 'getWP'.$wptype;
        $wpcontents = $this->$function($options, $value);

        // Return value
        return $wpcontents;
    }
protected function getWPContents ( $ type = 'posts' , $ multiple = false , $ options = [ ] , $ post_id = 0 , $ value = '' ) { // Access WordPress contents $ wpcontents = [ ] ; // Exclude current item if ( isset ( $ options [ 'exclude' ] ) && 'current' === $ options [ 'exclude' ] ) { $ options [ 'exclude' ] = $ post ; } // Get asked contents $ authorized = [ 'categories' , 'category' , 'menus' , 'menu' , 'pages' , 'page' , 'posts' , 'post' , 'posttypes' , 'posttype' , 'tags' , 'tag' , 'taxonomies' , 'taxonomy' , 'terms' , 'term' ] ; // Check contents if ( ! in_array ( $ type , $ authorized ) ) { return [ ] ; } // Data retrieved if ( in_array ( $ type , [ 'categories' , 'category' ] ) ) { $ wptype = 'Categories' ; } else if ( in_array ( $ type , [ 'menus' , 'menu' ] ) ) { $ wptype = 'Menus' ; } else if ( in_array ( $ type , [ 'pages' , 'page' ] ) ) { $ wptype = 'Pages' ; } else if ( in_array ( $ type , [ 'posts' , 'post' ] ) ) { $ wptype = 'Posts' ; } else if ( in_array ( $ type , [ 'posttypes' , 'posttype' ] ) ) { $ wptype = 'Posttypes' ; } else if ( in_array ( $ type , [ 'tags' , 'tag' ] ) ) { $ wptype = 'Tags' ; } else if ( in_array ( $ type , [ 'taxonomies' , 'taxonomy' ] ) ) { $ wptype = 'Taxonomies' ; } else { $ wptype = 'Terms' ; } // Get contents $ function = 'getWP' . $ wptype ; $ wpcontents = $ this -> $ function ( $ options , $ value ) ; // Return value return $ wpcontents ; }
Get Wordpress contents already registered.

@param   string  $type       Wordpress content type to return
@param   boolean $multiple   Define if there is multiselect or not
@param   array   $options    Define options if needed
@param   integer $post_id    Define the post ID for meta boxes
@param   string  $value      Define the value of each select options
@return  array   $wpcontents Array of Wordpress content type registered
Get Wordpress contents already registered .