Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Wp_Helpers::all_post_types( string $label = null, string $option_code = 'WPPOSTTYPES', $args = array() )
Contents
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Parameters Parameters
- $label
(Optional)
Default value: null
- $option_code
(Optional)
Default value: 'WPPOSTTYPES'
Return Return
(mixed)
Source Source
File: src/integrations/wp/helpers/wp-helpers.php
public function all_post_types( $label = null, $option_code = 'WPPOSTTYPES', $args = array() ) { if ( ! $this->load_options ) { return Automator()->helpers->recipe->build_default_options_array( $label, $option_code ); } if ( ! $label ) { $label = esc_attr__( 'Post type', 'uncanny-automator' ); } $token = key_exists( 'token', $args ) ? $args['token'] : false; $is_ajax = key_exists( 'is_ajax', $args ) ? $args['is_ajax'] : false; $target_field = key_exists( 'target_field', $args ) ? $args['target_field'] : ''; $end_point = key_exists( 'endpoint', $args ) ? $args['endpoint'] : ''; $options = array(); if ( Automator()->helpers->recipe->load_helpers ) { $args = array( 'public' => true, '_builtin' => false, ); $output = 'object'; $operator = 'and'; $post_types = get_post_types( $args, $output, $operator ); if ( ! empty( $post_types ) ) { foreach ( $post_types as $post_type ) { $options[ $post_type->name ] = esc_html( $post_type->labels->singular_name ); } } } $type = 'select'; $option = array( 'option_code' => $option_code, 'label' => $label, 'input_type' => $type, 'required' => true, 'supports_tokens' => $token, 'is_ajax' => $is_ajax, 'fill_values_in' => $target_field, 'endpoint' => $end_point, 'options' => $options, ); return apply_filters( 'uap_option_all_post_types', $option ); }
Expand full source code Collapse full source code View on Github