Memberpress_Helpers::all_memberpress_products_recurring( string $label = null, string $option_code = 'MPPRODUCT', array $args = array() )
Contents
Parameters Parameters
- $label
-
(string) (Optional)
Default value: null
- $option_code
-
(string) (Optional)
Default value: 'MPPRODUCT'
- $args
-
(array) (Optional)
Default value: array()
Return Return
(mixed)
Source Source
File: src/integrations/memberpress/helpers/memberpress-helpers.php
public function all_memberpress_products_recurring( $label = null, $option_code = 'MPPRODUCT', $args = array() ) { if ( ! $this->load_options ) { return Automator()->helpers->recipe->build_default_options_array( $label, $option_code ); } if ( ! $label ) { $label = esc_attr__( 'Product', 'uncanny-automator' ); } $args = wp_parse_args( $args, array( 'uo_include_any' => false, 'uo_any_label' => esc_attr__( 'Any recurring subscription product', 'uncanny-automator' ), ) ); $options = array(); if ( $args['uo_include_any'] ) { $options[ - 1 ] = $args['uo_any_label']; } $query_args = [ 'post_type' => 'memberpressproduct', 'posts_per_page' => 999, 'post_status' => 'publish', 'meta_query' => [ [ 'key' => '_mepr_product_period_type', 'value' => 'lifetime', 'compare' => '!=', ], ], ]; $options = Automator()->helpers->recipe->wp_query( $query_args ); $option = [ 'option_code' => $option_code, 'label' => $label, 'input_type' => 'select', 'required' => true, 'options' => $options, 'relevant_tokens' => [ $option_code => esc_attr__( 'Product title', 'uncanny-automator' ), $option_code . '_ID' => esc_attr__( 'Product ID', 'uncanny-automator' ), $option_code . '_URL' => esc_attr__( 'Product URL', 'uncanny-automator' ), ], ]; return apply_filters( 'uap_option_all_memberpress_products_recurring', $option ); }
Expand full source code Collapse full source code View on Github