Function
Core, formatting and countries functions
On this page
- rpress_record_log()
- rpress_debug_log()
- rpress_register_template_pack()
- rpress_get_template_packs()
- rpress_get_active_template_pack()
- rpress_pack_selector_callback()
- rpress_pack_thumb_svg()
- rpress_get_shop_country()
- rpress_get_shop_state()
- rpress_get_states()
- rpress_get_country_list()
- rpress_get_states_list()
- rpress_get_angola_provinces_list()
- rpress_get_provinces_list()
- rpress_get_australian_states_list()
- rpress_get_bangladeshi_states_list()
- rpress_get_brazil_states_list()
- rpress_get_bulgarian_states_list()
- rpress_get_hong_kong_states_list()
- rpress_get_hungary_states_list()
- rpress_get_japanese_states_list()
- rpress_get_chinese_states_list()
- rpress_get_united_kingdom_states_list()
- rpress_get_new_zealand_states_list()
- rpress_get_peruvian_states_list()
- rpress_get_indonesian_states_list()
- rpress_get_indian_states_list()
- rpress_get_iranian_states_list()
- rpress_get_italian_states_list()
- rpress_get_malaysian_states_list()
- rpress_get_mexican_states_list()
- rpress_get_nepalese_states_list()
- rpress_get_south_african_states_list()
- rpress_get_thailand_states_list()
- rpress_get_turkey_states_list()
- rpress_get_spain_states_list()
- rpress_get_country_name()
- rpress_get_state_name()
- rpress_print_errors()
- rpress_get_errors()
- rpress_set_error()
- rpress_clear_errors()
- rpress_unset_error()
- _rpress_die_handler()
- rpress_die()
- rpress_sanitize_amount()
- rpress_get_currency_value_type()
- rpress_get_currency_display_decimals()
- rpress_format_amount()
- rpress_currency_filter()
- rpress_currency_decimal_filter()
- rpress_sanitize_key()
- rpress_sanitize_array()
- rpress_get_actions()
- rpress_post_actions()
- rpress_upgrade_data()
- rpress_is_ajax_enabled()
- rpress_is_ajax_disabled()
- rpress_test_ajax_works()
- rpress_get_ajax_url()
- get_fooditem_lists()
- rpress_addon_items_by_fooditem()
- rpress_get_admin_order_addon_groups()
- rpress_get_cart_items_by_key()
- rpress_get_cart_item_by_price()
- addon_category_taxonomy_custom_fields()
- save_addon_category_custom_fields()
- rpress_get_item_qty_by_key()
- rpress_popup()
- rpress_datetime_popup()
- get_fooditems_categories()
- rpress_search_form()
- rpress_foodsearch_callback()
- rpress_rpress_cart_callback()
- myplugin_custom_forgot_password_form()
- rpress_product_menu_tab()
- get_special_instruction()
- rpress_get_instruction_by_key()
- rpress_is_preorder_enabled()
- rpress_get_service_date_cookie_display()
- get_delivery_options()
- get_date_time_options()
- rpress_store_custom_fields()
- rpress_order_note_fields()
- rpress_add_phone()
- rpress_get_service_type()
- rpress_remove_view_link()
- rpress_remove_tax_view_link()
- rpress_remove_food_cat_view_link()
- rp_get_store_timings()
- rp_get_current_time()
- rpress_get_wp_timezone()
- rpress_get_wp_now()
- rpress_parse_wp_datetime()
- rpress_get_wp_timestamp()
- rp_current_date()
- rpress_local_date()
- rpress_format_service_date()
- rpress_format_service_time()
- rpress_get_categories()
- rpress_get_service_types()
- rpress_get_enabled_services()
- rpress_get_default_enabled_service()
- rpress_get_enabled_service_types()
- rp_get_store_service_hours()
- rpress_get_child_cats()
- rpress_fooditem_update_messages()
- rp_selected()
- rpress_selected_service()
- rpress_service_label()
- rpress_checkout_delivery_type()
- rpress_get_available_service_slots()
- rpress_get_first_available_service_date()
- rpress_get_selected_service_date()
- rpress_match_service_time_to_slot()
- rpress_get_next_available_service_time()
- rpress_pre_validate_order()
- rpress_is_test_mode()
- rpress_is_debug_mode()
- rpress_no_guest_checkout()
- rpress_straight_to_checkout()
- rpress_is_cc_verify_enabled()
- is_restropress_page()
- rpress_post_has_shortcode_content()
- rpress_is_odd()
- rpress_get_file_extension()
- rpress_string_is_image_url()
- rpress_get_ip()
- rpress_get_host()
- rpress_is_host()
- rpress_get_currencies()
- rpress_get_currency()
- rpress_currency_symbol()
- rpress_get_currency_name()
- rpress_month_num_to_name()
- rpress_get_php_arg_separator_output()
- rpress_get_current_page_url()
- rpress_add_cache_busting()
- _rpress_deprecated_function()
- _rpress_deprected_argument()
- rpress_is_func_disabled()
- rpress_let_to_num()
- rpress_get_symlink_url()
- rpress_get_symlink_dir()
- rpress_get_upload_dir()
- rpress_cleanup_file_symlinks()
- rpress_use_skus()
- rpress_get_timezone_id()
- rpress_object_to_array()
- rpress_set_upload_dir()
- rpress_has_upgrade_completed()
- rpress_get_completed_upgrades()
- cal_days_in_month()
- hash_equals()
- getallheaders()
- rpress_can_view_receipt()
- rpress_payment_get_ip_address_url()
- rpress_doing_cron()
- rp_help_tip()
- rpress_is_service_enabled()
- rpress_fooditem_available()
- rp_get_label_singular()
- rp_get_label_plural()
- rp_get_default_labels()
- rpress_get_fooditem_icon()
- rpress_default_notification_sound()
- rp_get_checkout_fields()
- my_plugin_handle_setup_form()
- rpress_is_store_open()
- rpress_store_closed_message()
- rpress_get_service_context()
- rp_row_date()
- rpress_process_profile_editor_updates()
- rpress_process_profile_editor_remove_email()
- rpress_register_widgets()
General helper functions: options, dates and times, formatting, countries, AJAX helpers and error tracking.
175 functions. Each entry shows the signature, parameters, return value and where it is defined. Functions marked internal are hook callbacks, screen renderers and other plumbing that extensions normally do not call.
rpress_record_log()#
Creates a log entry (an rpress_log post) through the global RPRESS_Logging object.
Wraps RPRESS_Logging::add(). If $type is one of the registered log types (sale, file_fooditem, gateway_error, api_request, plus anything added with the rpress_log_types filter), the entry is also assigned to that type. Fires rpress_pre_insert_log and rpress_post_insert_log.
rpress_record_log( $title = '', $message = '', $parent = 0, $type = null )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$title | string | '' | Log entry title. |
$message | string | '' | Log entry content. |
$parent | int | 0 | Parent post ID the log is attached to. |
$type | string|null | null | Log type slug. |
Returns int|WP_Error: The ID of the new log entry, as returned by wp_insert_post().
Example
rpress_record_log( 'Gateway error', 'Card declined for order 123', 123, 'gateway_error' );
Defined in includes/class-rpress-logging.php, line 429.
rpress_debug_log()#
Appends a timestamped message to the RestroPress debug log file.
Writes only when debug mode is on (rpress_is_debug_mode()); otherwise the call does nothing.
rpress_debug_log( $message = '' )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$message | string | '' | Text to write. |
Example
rpress_debug_log( 'Order sync started for payment ' . $payment_id );
Defined in includes/class-rpress-logging.php, line 443.
rpress_register_template_pack()#
Registers a template pack that can be chosen in the Styles settings.
Call it from a callback on the rpress_register_template_packs action. id and label are required; without them the call triggers _doing_it_wrong() and returns false. Other keys are description, version, preview, dir, url, stylesheet, tokens, fonts, variants and pro. id is passed through sanitize_key() and dir gets a trailing slash. Registering an existing id replaces that pack.
rpress_register_template_pack( $args )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$args | array | Required | Pack arguments. Keys: id, label, description, version, preview, dir, url, stylesheet, tokens, fonts, variants, pro. |
Returns bool: True when the pack was registered, false when id or label is missing.
Example
add_action( 'rpress_register_template_packs', function () {
rpress_register_template_pack( array(
'id' => 'bistro',
'label' => 'Bistro',
'description' => 'A custom storefront look.',
'dir' => plugin_dir_path( __FILE__ ) . 'templates/bistro',
) );
} );
Defined in includes/class-rpress-template-packs.php, line 354.
rpress_get_template_packs()#
Returns all registered template packs.
rpress_get_template_packs()
Returns array: Registered packs keyed by pack id; each value is the pack argument array.
Defined in includes/class-rpress-template-packs.php, line 364.
rpress_get_active_template_pack()#
Returns the template pack currently in use.
Reads the template_pack setting. Legacy mode (the old_ui_ux setting) forces the Classic pack, and an unknown or removed pack id also resolves to Classic, so the result is always a valid pack.
rpress_get_active_template_pack()
Returns array: The active pack's argument array.
Example
$pack = rpress_get_active_template_pack();
$pack_id = $pack['id'];
Defined in includes/class-rpress-template-packs.php, line 374.
rpress_pack_selector_callback()#
Renders the template pack picker used by the pack_selector settings field type.
Prints a card for each registered pack with its preview, name, description and active state. Pro packs without an entitlement are shown locked. Prints the field's CSS once per request.
rpress_pack_selector_callback( $args )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$args | array | Required | Settings field arguments; id is used to build the rpress_settings[...] input name. |
Note: Echoes output instead of returning it.
Internal. Defined in includes/class-rpress-template-packs.php, line 387.
rpress_pack_thumb_svg()#
Returns an inline SVG thumbnail for a template pack card.
Used when a pack ships no preview image. The ids 'classic' and 'modern' get their own artwork; any other id gets a neutral placeholder.
rpress_pack_thumb_svg( $pack_id )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$pack_id | string | Required | Pack identifier. |
Returns string: SVG markup.
Internal. Defined in includes/class-rpress-template-packs.php, line 566.
rpress_get_shop_country()#
Returns the two-letter country code of the store's base country.
Reads the base_country setting (default US) and passes it through the rpress_shop_country filter.
rpress_get_shop_country()
Returns string: ISO country code.
Example
$country = rpress_get_shop_country();
Defined in includes/country-functions.php, line 19.
rpress_get_shop_state()#
Returns the store's base state setting.
Reads the base_state setting and passes it through the rpress_shop_state filter.
rpress_get_shop_state()
Returns string|false: The saved state value, or false when none is set.
Defined in includes/country-functions.php, line 29.
rpress_get_states()#
Returns the list of states or provinces for a country.
If $country is empty, the store's base country is used. Only countries that ship with a built-in list return data (US, AO, CA, AU, BD, BG, BR, CN, GB, HK, HU, ID, IN, IR, IT, JP, MX, MY, NP, NZ, PE, TH, TR, ZA, ES); any other country returns an empty array. The result is passed through the rpress_shop_states filter.
rpress_get_states( $country = null )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$country | string|null | null | Two-letter country code. |
Returns array: State codes mapped to names; empty when the country has no built-in list.
Example
$states = rpress_get_states( 'IN' );
foreach ( $states as $code => $name ) {
echo esc_html( $code . ': ' . $name ) . "\n";
}
Defined in includes/country-functions.php, line 41.
rpress_get_country_list()#
Returns the list of countries RestroPress knows about.
The result is passed through the rpress_countries filter. The first entry is an empty string key used for a blank option.
rpress_get_country_list()
Returns array: Two-letter country codes mapped to country names.
Defined in includes/country-functions.php, line 134.
rpress_get_states_list()#
Returns the list of United States states.
The result is passed through the rpress_us_states filter. This is the list rpress_get_states() uses for the US.
rpress_get_states_list()
Returns array: State codes mapped to names; starts with an empty entry.
Internal. Defined in includes/country-functions.php, line 398.
rpress_get_angola_provinces_list()#
Returns the list of Angolan provinces.
The result is passed through the rpress_angola_provinces filter.
rpress_get_angola_provinces_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 476.
rpress_get_provinces_list()#
Returns the list of Canadian provinces and territories.
The result is passed through the rpress_canada_provinces filter.
rpress_get_provinces_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 506.
rpress_get_australian_states_list()#
Returns the list of Australian states and territories.
The result is passed through the rpress_australian_states filter.
rpress_get_australian_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 531.
rpress_get_bangladeshi_states_list()#
Returns the list of Bangladeshi districts.
The result is passed through the rpress_bangladeshi_states filter.
rpress_get_bangladeshi_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 551.
rpress_get_brazil_states_list()#
Returns the list of Brazilian states.
The result is passed through the rpress_brazil_states filter.
rpress_get_brazil_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 627.
rpress_get_bulgarian_states_list()#
Returns the list of Bulgarian provinces.
The result is passed through the rpress_bulgarian_states filter.
rpress_get_bulgarian_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 666.
rpress_get_hong_kong_states_list()#
Returns the list of Hong Kong regions.
The result is passed through the rpress_hong_kong_states filter.
rpress_get_hong_kong_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 706.
rpress_get_hungary_states_list()#
Returns the list of Hungarian counties.
The result is passed through the rpress_hungary_states filter.
rpress_get_hungary_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 721.
rpress_get_japanese_states_list()#
Returns the list of Japanese prefectures.
The result is passed through the rpress_japanese_states filter.
rpress_get_japanese_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 753.
rpress_get_chinese_states_list()#
Returns the list of Chinese provinces.
The result is passed through the rpress_chinese_states filter.
rpress_get_chinese_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 812.
rpress_get_united_kingdom_states_list()#
Returns the list of United Kingdom regions.
The result is passed through the rpress_united_kingdom_states filter.
rpress_get_united_kingdom_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 856.
rpress_get_new_zealand_states_list()#
Returns the list of New Zealand regions.
The result is passed through the rpress_new_zealand_states filter.
rpress_get_new_zealand_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1085.
rpress_get_peruvian_states_list()#
Returns the list of Peruvian regions.
The result is passed through the rpress_peruvian_states filter.
rpress_get_peruvian_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1113.
rpress_get_indonesian_states_list()#
Returns the list of Indonesian provinces.
The result is passed through the rpress_indonesia_states filter.
rpress_get_indonesian_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1151.
rpress_get_indian_states_list()#
Returns the list of Indian states and union territories.
The result is passed through the rpress_indian_states filter.
rpress_get_indian_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1197.
rpress_get_iranian_states_list()#
Returns the list of Iranian provinces.
The result is passed through the rpress_iranian_states filter.
rpress_get_iranian_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1245.
rpress_get_italian_states_list()#
Returns the list of Italian provinces.
The result is passed through the rpress_italian_states filter.
rpress_get_italian_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1288.
rpress_get_malaysian_states_list()#
Returns the list of Malaysian states.
The result is passed through the rpress_malaysian_states filter.
rpress_get_malaysian_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1410.
rpress_get_mexican_states_list()#
Returns the list of Mexican states.
The result is passed through the rpress_mexican_states filter.
rpress_get_mexican_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1438.
rpress_get_nepalese_states_list()#
Returns the list of Nepalese districts.
The result is passed through the rpress_nepalese_states filter.
rpress_get_nepalese_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1482.
rpress_get_south_african_states_list()#
Returns the list of South African provinces.
The result is passed through the rpress_south_african_states filter.
rpress_get_south_african_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1569.
rpress_get_thailand_states_list()#
Returns the list of Thai provinces.
The result is passed through the rpress_thailand_states filter.
rpress_get_thailand_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1590.
rpress_get_turkey_states_list()#
Returns the list of Turkish provinces.
The result is passed through the rpress_turkey_states filter.
rpress_get_turkey_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1679.
rpress_get_spain_states_list()#
Returns the list of Spanish provinces.
The result is passed through the rpress_spain_states filter.
rpress_get_spain_states_list()
Returns array: Region codes mapped to names.
Internal. Defined in includes/country-functions.php, line 1772.
rpress_get_country_name()#
Returns the display name for a country code.
If the code is not in the country list, the code itself is returned. The result is passed through the rpress_get_country_name filter.
rpress_get_country_name( $country_code = '' )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$country_code | string | '' | Two-letter country code. |
Returns string: Country name, or the code unchanged when unknown.
Example
echo esc_html( rpress_get_country_name( 'GB' ) );
Defined in includes/country-functions.php, line 1838.
rpress_get_state_name()#
Returns the display name for a state code within a country.
If the code is not in that country's list, the code itself is returned. An empty country code falls back to the store's base country through rpress_get_states(). The result is passed through the rpress_get_state_name filter.
rpress_get_state_name( $country_code = '', $state_code = '' )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$country_code | string | '' | Two-letter country code. |
$state_code | string | '' | State or province code. |
Returns string: State name, or the code unchanged when unknown.
Example
echo esc_html( rpress_get_state_name( 'US', 'CA' ) );
Defined in includes/country-functions.php, line 1852.
rpress_print_errors()#
Prints the stored checkout errors as HTML and then clears them.
Does nothing when no errors are stored. The wrapper classes can be changed with the rpress_error_class filter. Hooked to rpress_purchase_form_before_submit, rpress_ajax_checkout_errors and rpress_print_errors.
rpress_print_errors()
Example
do_action( 'rpress_print_errors' );
Note: Echoes output instead of returning it, and clears the errors after printing.
Defined in includes/error-tracking.php, line 24.
rpress_get_errors()#
Returns the errors stored in the session.
Reads the rpress_errors session value and passes it through the rpress_errors filter.
rpress_get_errors()
Returns array|false|null: Error messages keyed by error id, or an empty value when none are stored.
Example
$errors = rpress_get_errors();
if ( ! empty( $errors ) ) {
error_log( print_r( $errors, true ) );
}
Defined in includes/error-tracking.php, line 54.
rpress_set_error()#
Stores an error message in the session under an error id.
Adds to any existing errors; setting an id that already exists replaces its message. Typically called during checkout validation and displayed with rpress_print_errors().
rpress_set_error( $error_id, $error_message )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$error_id | int|string | Required | Identifier for the error. |
$error_message | string | Required | Message to store. |
Example
rpress_set_error( 'invalid_phone', __( 'Please enter a valid phone number.', 'my-plugin' ) );
Defined in includes/error-tracking.php, line 70.
rpress_clear_errors()#
Removes all errors stored in the session.
rpress_clear_errors()
Defined in includes/error-tracking.php, line 85.
rpress_unset_error()#
Removes one stored error by its id.
Does nothing when no errors are stored.
rpress_unset_error( $error_id )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$error_id | int|string | Required | Identifier of the error to remove. |
Example
rpress_unset_error( 'invalid_phone' );
Defined in includes/error-tracking.php, line 96.
_rpress_die_handler()#
Returns or ends execution for rpress_die().
Registered as the wp_die handler by rpress_die(). Calls die() normally; when RPRESS_UNIT_TESTS is defined it returns its own name so tests can continue.
_rpress_die_handler()
Returns string|void: The function name when RPRESS_UNIT_TESTS is defined; otherwise the script ends.
Internal. Defined in includes/error-tracking.php, line 110.
rpress_die()#
Ends the request with wp_die(), using a handler that can be swapped out in tests.
Adds the wp_die_ajax_handler and wp_die_handler filters, then calls wp_die(). The message is passed through wp_kses_post(), the title through esc_html(), and the status through absint(). The $status becomes the HTTP response code.
rpress_die( $message = '', $title = '', $status = 400 )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$message | string | '' | Message to show; limited HTML is allowed. |
$title | string | '' | Page title. |
$status | int | 400 | HTTP response code. |
Example
rpress_die( __( 'You are not allowed to do that.', 'my-plugin' ), __( 'Error', 'my-plugin' ), 403 );
Note: Ends script execution.
Defined in includes/error-tracking.php, line 125.
rpress_sanitize_amount()#
Converts a price entered in store format into a plain decimal string.
Uses the thousands_separator and decimal_separator settings to strip separators and normalise the decimal point, removes any other non-numeric characters, and rounds to the currency's decimal count (0 for RIAL, JPY, TWD and HUF, otherwise 2). Negative values stay negative. Passes the result through the rpress_sanitize_amount filter.
rpress_sanitize_amount( $amount )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$amount | string|float | Required | Price as typed or stored. |
Returns string|float: Decimal string such as '1234.50'; a negative amount is returned as a number.
Example
$amount = rpress_sanitize_amount( '1,234.50' ); // '1234.50' with default separators
Note: Negative amounts are multiplied by -1 after formatting, so they come back as a float or int rather than a string.
Defined in includes/formatting.php, line 22.
rpress_get_currency_value_type()#
Returns how prices are displayed: 'float' or 'round'.
Reads the currency_value_type setting; any other stored value becomes 'float'. The result is passed through the rpress_currency_value_type filter.
rpress_get_currency_value_type()
Returns string: 'float' to show decimals, 'round' to show whole numbers.
Defined in includes/formatting.php, line 70.
rpress_get_currency_display_decimals()#
Returns the number of decimals to use when showing prices.
Returns 0 when the currency value type is 'round'; otherwise returns the given value. The result is passed through the rpress_currency_display_decimals filter.
rpress_get_currency_display_decimals( $decimals = 2 )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$decimals | int | 2 | Decimal places before the round setting is applied. |
Returns int: Decimal places to display.
Defined in includes/formatting.php, line 87.
rpress_format_amount()#
Formats a number using the store's thousands and decimal separators.
Cleans the input with rpress_sanitize_amount(), applies the display decimal rules, and returns a string with the configured separators. When $decimals is false no decimals are shown; with a 'round' currency value type the amount is rounded to a whole number. The result is passed through the rpress_format_amount filter. It adds no currency symbol; use rpress_currency_filter() for that.
rpress_format_amount( $amount, $decimals = true )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$amount | string|float | Required | Amount to format. |
$decimals | bool | true | Set false to drop decimals, for non-currency numbers. |
Returns string: The formatted amount.
Example
echo esc_html( rpress_format_amount( 1234.5 ) ); // 1,234.50 with default settings
Defined in includes/formatting.php, line 107.
rpress_currency_filter()#
Formats a price with the currency symbol in the configured position.
Numeric prices are first run through rpress_format_amount(). The symbol goes before or after the amount according to the currency_position setting; currencies without a listed symbol format use the currency code. Negative prices keep a leading minus sign. Fires a rpress_{currency}_currency_filter_before or _after filter. If $currency is empty the store currency is used.
rpress_currency_filter( $price = '', $currency = '' )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$price | string|float | '' | Price to format. |
$currency | string | '' | Currency code; defaults to the store currency. |
Returns string: The price with currency symbol or code.
Example
echo esc_html( rpress_currency_filter( rpress_format_amount( 12.5 ) ) );
Note: The docblock describes the return as an array; the function returns a string. The output may contain HTML entities from the symbol, so check how it is escaped.
Defined in includes/formatting.php, line 151.
rpress_currency_decimal_filter()#
Returns the decimal places to use for the current store currency.
Returns 0 for RIAL, JPY, TWD and HUF and the given value for other currencies. The result is passed through the rpress_currency_decimal_count filter. Hooked to rpress_sanitize_amount_decimals and rpress_format_amount_decimals.
rpress_currency_decimal_filter( $decimals = 2 )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$decimals | int | 2 | Default number of decimals. |
Returns int: Decimal places.
Internal. Defined in includes/formatting.php, line 267.
rpress_sanitize_key()#
Strips a settings key down to safe characters.
Keeps letters, digits, underscore, dash, dot, colon and slash and removes everything else. The result is passed through the rpress_sanitize_key filter.
rpress_sanitize_key( $key )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$key | string | Required | Raw key. |
Returns string: Sanitized key.
Defined in includes/formatting.php, line 290.
rpress_sanitize_array()#
Runs sanitize_text_field() on every value of an array, recursing into nested arrays.
The array is taken by reference and modified in place; the same array is also returned.
rpress_sanitize_array( &$array )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
&$array | array | Required | Array to sanitize, passed by reference. |
Returns array: The sanitized array.
Example
$data = array( 'name' => ' <b>Pizza</b> ', 'tags' => array( 'a<script>', 'b' ) );
$clean = rpress_sanitize_array( $data );
Note: Takes its argument by reference, so pass a variable, not a literal or function result.
Defined in includes/formatting.php, line 310.
rpress_get_actions()#
Fires the rpress_{action} hook for a rpress_action value in the query string.
Reads $_GET['rpress_action'] and calls do_action( 'rpress_' . $action, $_GET ). Hooked to init. Nothing runs when the parameter is absent.
rpress_get_actions()
Internal. Defined in includes/rp-actions.php, line 21.
rpress_post_actions()#
Fires the rpress_{action} hook for a rpress_action value in POST data.
Reads $_POST['rpress_action'] and calls do_action( 'rpress_' . $action, $data ) where $data is the POST array sanitized with rpress_sanitize_array(). Hooked to init.
rpress_post_actions()
Internal. Defined in includes/rp-actions.php, line 36.
rpress_upgrade_data()#
Copies the first stored tax rate into the tax_rate setting after a plugin update.
Hooked to upgrader_process_complete. For a plugin update whose plugin list contains this file's own plugin basename, it reads the rpress_tax_rates option and, if the first rate is non-empty, saves it with rpress_update_option( 'tax_rate', ... ).
rpress_upgrade_data( $upgrader_object, $options )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$upgrader_object | WP_Upgrader | Required | Upgrader instance (unused). |
$options | array | Required | Upgrade context with 'action', 'type' and 'plugins' keys. |
Note: The comparison uses plugin_basename( __FILE__ ) of the file that defines the function, not of the main plugin file.
Internal. Defined in includes/rp-actions.php, line 49.
rpress_is_ajax_enabled()#
Checks whether RestroPress AJAX is enabled.
Returns the opposite of rpress_is_ajax_disabled(), passed through the rpress_is_ajax_enabled filter.
rpress_is_ajax_enabled()
Returns bool: True when AJAX is enabled.
Defined in includes/rp-ajax-functions.php, line 24.
rpress_is_ajax_disabled()#
Checks whether RestroPress AJAX is disabled.
Always false unless changed by the rpress_is_ajax_disabled filter; the setting to disable AJAX no longer exists.
rpress_is_ajax_disabled()
Returns bool: True when AJAX is disabled.
Defined in includes/rp-ajax-functions.php, line 36.
rpress_test_ajax_works()#
Checks that a POST to admin-ajax.php with the rpress_test_ajax action responds correctly.
Returns true immediately when the Airplane Mode plugin is active and on, or when a successful result is cached in the _rpress_ajax_works transient (one day). Otherwise it makes a remote POST to rpress_get_ajax_url() with a 30 second timeout and sslverify off, and caches a success.
rpress_test_ajax_works()
Returns bool: True when the request returns HTTP 200 with body 0.
Note: Makes an HTTP request to the site itself, so it can be slow.
Defined in includes/rp-ajax-functions.php, line 46.
rpress_get_ajax_url()#
Returns the admin-ajax.php URL, matched to the current page's protocol.
Uses https or http to match the current request when the admin URL scheme differs. The result is passed through the rpress_ajax_url filter.
rpress_get_ajax_url()
Returns string: AJAX endpoint URL.
Example
wp_localize_script( 'my-script', 'myData', array( 'ajaxUrl' => rpress_get_ajax_url() ) );
Defined in includes/rp-ajax-functions.php, line 101.
get_fooditem_lists()#
Builds the HTML of the variable price options and add-on groups for a menu item.
Reads the menu item's _addon_items meta and its variable prices. When $cart_key is given, the price option and add-ons already chosen for that cart row are pre-selected. Output is captured and returned rather than printed.
get_fooditem_lists($fooditem_id, $cart_key = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$fooditem_id | int | Required | Menu item ID. |
$cart_key | string|int | '' | Cart row key to read selections from. |
Returns string: HTML markup.
Note: The docblock says void, but the function returns the markup.
Internal. Defined in includes/rp-ajax-functions.php, line 119.
rpress_addon_items_by_fooditem()#
Prints <option> elements for the add-on items of a menu item.
Looks up each add-on group in the menu item's _addon_items meta and echoes an <option> per child item, with the name, id, price and quantity 1 in the value. For a variable-price item, a price-specific add-on price is used when $price_id matches. Returns early with no output when $fooditem_id is empty.
rpress_addon_items_by_fooditem($fooditem_id, $price_id = null)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$fooditem_id | int | Required | Menu item ID. |
$price_id | int|string|null | null | Variable price ID. |
Note: Echoes output instead of returning it.
Internal. Defined in includes/rp-ajax-functions.php, line 407.
rpress_get_admin_order_addon_groups()#
Returns the add-on groups of a menu item as data for the admin order item modal.
Each group holds id, name, type (single or multiple), input_type (radio or checkbox), required, min, max and an items array. Each item has id, name, price, formatted, value and selected. The value uses the format 'name|id|price|1'. Child items are sorted by their addon_position term meta. Empty groups and groups whose add-on group term is missing are skipped.
rpress_get_admin_order_addon_groups($fooditem_id, $price_id = null)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$fooditem_id | int | Required | Menu item ID. |
$price_id | int|string|null | null | Variable price ID, used to resolve price-specific add-on prices and defaults. |
Returns array: List of add-on group arrays; empty when the item has none.
Example
$groups = rpress_get_admin_order_addon_groups( $fooditem_id );
foreach ( $groups as $group ) {
echo esc_html( $group['name'] ) . ': ' . count( $group['items'] ) . " items\n";
}
Defined in includes/rp-ajax-functions.php, line 478.
rpress_get_cart_items_by_key()#
Returns the add-on rows of a cart item.
Reads the cart contents and returns the 'addon_items' array of the row at $key. Returns an empty array when the key is empty, the cart is empty or the row has no add-ons.
rpress_get_cart_items_by_key($key)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$key | int|string | Required | Cart row key. |
Returns array: Add-on rows of the cart item.
Example
$addons = rpress_get_cart_items_by_key( 0 );
Note: Accessing a key that does not exist in a non-empty cart triggers a PHP notice.
Defined in includes/rp-core-functions.php, line 22.
rpress_get_cart_item_by_price()#
Returns the combined price of a cart row's menu item and its add-ons.
Multiplies the menu item's base price from rpress_get_fooditem_price() by the row quantity, then adds each add-on row's stored 'price' value. Add-on prices are added as stored, not multiplied by the row quantity.
rpress_get_cart_item_by_price($key)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$key | int|string | Required | Cart row key. |
Returns int|float: Sum of prices; 0 when the key is empty or the cart is empty.
Example
$total = rpress_get_cart_item_by_price( 0 );
Note: Accessing a key that does not exist in a non-empty cart triggers a PHP notice.
Defined in includes/rp-core-functions.php, line 45.
addon_category_taxonomy_custom_fields()#
Prints the extra fields on the add-on group term edit screen.
Shows a price field for child terms (add-on items) and a single/multiple selection type field for top-level terms. Hooked to addon_category_edit_form_fields.
addon_category_taxonomy_custom_fields($tag)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$tag | WP_Term | Required | Term being edited. |
Note: Echoes output instead of returning it.
Internal. Defined in includes/rp-core-functions.php, line 69.
save_addon_category_custom_fields()#
Saves the price and selection type of an add-on group term.
Reads $_POST['addon_meta'] and updates the _type and _price term meta when they are present and non-empty. Hooked to edited_addon_category.
save_addon_category_custom_fields($term_id)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$term_id | int | Required | Term ID. |
Internal. Defined in includes/rp-core-functions.php, line 118.
rpress_get_item_qty_by_key()#
Returns the quantity of a cart row.
Returns 0 when the row has no quantity. Returns null when $cart_key is empty and not the string '0'.
rpress_get_item_qty_by_key($cart_key)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$cart_key | int|string | Required | Cart row key. |
Returns int|null: Quantity, 0 when missing, or null for an empty key.
Example
$qty = rpress_get_item_qty_by_key( 0 );
Defined in includes/rp-core-functions.php, line 139.
rpress_popup()#
Loads the rpress-popup template into the page footer.
Hooked to wp_footer. Defined only if no function of the same name exists.
rpress_popup()
Note: Echoes output instead of returning it.
Internal. Defined in includes/rp-core-functions.php, line 154.
rpress_datetime_popup()#
Loads the rpress-datetime-popup template into the page footer.
Hooked to wp_footer. Defined only if no function of the same name exists.
rpress_datetime_popup()
Note: Echoes output instead of returning it.
Internal. Defined in includes/rp-core-functions.php, line 161.
get_fooditems_categories()#
Loads the get-categories template with the given parameters.
Hooked to the rp_get_categories action. Sets the global $data to $params and loads the rpress-get-categories template.
get_fooditems_categories($params)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$params | mixed | Required | Parameters made available to the template as the global $data. |
Note: Echoes output instead of returning it.
Internal. Defined in includes/rp-core-functions.php, line 168.
rpress_search_form()#
Prints the menu item search field.
Hooked to before_fooditems_list. Defined only if no function of the same name exists.
rpress_search_form()
Note: Echoes output instead of returning it.
Internal. Defined in includes/rp-core-functions.php, line 176.
rpress_foodsearch_callback()#
Renders the [foodsearch] shortcode.
rpress_foodsearch_callback()
Returns string: The search form markup.
Internal. Defined in includes/rp-core-functions.php, line 190.
rpress_rpress_cart_callback()#
Renders the [rpress_cart] shortcode.
Returns the output of the rpress_get_cart action.
rpress_rpress_cart_callback()
Returns string: The cart markup.
Internal. Defined in includes/rp-core-functions.php, line 199.
myplugin_custom_forgot_password_form()#
Renders the [custom_forgot_password] shortcode.
Shows a form for logged-out visitors and, on a valid nonce, looks the user up by login or email and calls retrieve_password(). Logged-in users see a short notice instead.
myplugin_custom_forgot_password_form()
Returns string: The form markup.
Internal. Defined in includes/rp-core-functions.php, line 209.
rpress_product_menu_tab()#
Prints the menu tab content using the [rpress_items] shortcode.
Defined only if no function of the same name exists.
rpress_product_menu_tab()
Note: Echoes output instead of returning it.
Internal. Defined in includes/rp-core-functions.php, line 266.
get_special_instruction()#
Returns the special instruction text from a cart item array.
Reads $items['options']['instruction'] when an 'options' key exists, otherwise $items['instruction']. The result is passed through the rpress_sepcial_instruction filter (spelled that way in the source).
get_special_instruction($items)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$items | array | Required | Cart item array. |
Returns string: Instruction text, empty when none.
Defined in includes/rp-core-functions.php, line 278.
rpress_get_instruction_by_key()#
Returns the special instruction saved on a cart row.
rpress_get_instruction_by_key($cart_key)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$cart_key | int|string | Required | Cart row key. |
Returns string: Instruction text, empty when none.
Example
$note = rpress_get_instruction_by_key( 0 );
Defined in includes/rp-core-functions.php, line 299.
rpress_is_preorder_enabled()#
Checks whether a pre-order extension has enabled pre-ordering.
Core RestroPress has no pre-ordering. This returns true when the enable_preorder setting is '1' (Pre-Order extension), or when the Store Timing & Delivery Cutoff extension is active and its pre_order or pre_order_pickup option is on for the current branch or default location. With $service_type set to 'delivery' or 'pickup', only that type's option is checked. The result is passed through the rpress_is_preorder_enabled filter.
rpress_is_preorder_enabled( $service_type = '' )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type | string | '' | 'delivery', 'pickup', or empty for any. |
Returns bool: True when pre-ordering is enabled.
Example
if ( rpress_is_preorder_enabled( 'delivery' ) ) {
// Future delivery dates can be offered.
}
Defined in includes/rp-core-functions.php, line 321.
rpress_get_service_date_cookie_display()#
Returns the customer's chosen service date from cookies, formatted for display.
Reads the service_date, delivery_date and service_date_manual cookies. Future dates are kept only when pre-ordering is enabled for the service type and the date was picked manually; otherwise the date resolves to today. Returns an empty string when no usable date cookie exists.
rpress_get_service_date_cookie_display( $service_type = '' )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type | string | '' | Service type slug. |
Returns string: Date formatted with the WordPress date format, or an empty string.
Defined in includes/rp-core-functions.php, line 363.
get_delivery_options()#
Returns HTML showing the chosen service type, date and time, with an optional change link.
Reads the service_type, service_date, service_time and service_time_text cookies. An ASAP label is translated. The time is hidden when rp_otil_is_service_time_hidden() exists and returns true.
get_delivery_options($changeble)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$changeble | bool | Required | Whether to include the change link. |
Returns string: HTML markup.
Note: Returns markup although the docblock says it outputs it.
Internal. Defined in includes/rp-core-functions.php, line 392.
get_date_time_options()#
Returns HTML showing the chosen service date and time, with an optional change link.
Same as get_delivery_options() except that the service type label is not shown, only the date and time.
get_date_time_options($changeble)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$changeble | bool | Required | Whether to include the change link. |
Returns string: HTML markup.
Internal. Defined in includes/rp-core-functions.php, line 448.
rpress_store_custom_fields()#
Adds the submitted delivery address fields to the delivery address meta.
Filter callback for rpress_delivery_address_meta. Sets address, flat, city and postcode from the POST fields rpress_street_address, rpress_apt_suite, rpress_city and rpress_postcode, each sanitized, or empty strings when absent.
rpress_store_custom_fields($delivery_address_meta)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$delivery_address_meta | array | Required | Existing delivery address meta. |
Returns array: The meta array with address, flat, city and postcode set.
Internal. Defined in includes/rp-core-functions.php, line 504.
rpress_order_note_fields()#
Returns the order note from the POST data.
Filter callback for rpress_order_note_meta. Ignores the incoming value and returns the sanitized POST field rpress_order_note, or an empty string.
rpress_order_note_fields($order_note)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$order_note | string | Required | Existing note (ignored). |
Returns string: Sanitized order note.
Internal. Defined in includes/rp-core-functions.php, line 517.
rpress_add_phone()#
Adds the submitted phone number to the payment meta.
Filter callback for rpress_payment_meta. Sets $payment_meta['phone'] from the sanitized POST field rpress_phone when it is not empty.
rpress_add_phone($payment_meta)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$payment_meta | array | Required | Payment meta. |
Returns array: The payment meta, with phone when submitted.
Internal. Defined in includes/rp-core-functions.php, line 526.
rpress_get_service_type()#
Returns the service type saved on an order.
Reads the _rpress_delivery_type post meta and lowercases it. Returns nothing when $payment_id is falsy.
rpress_get_service_type($payment_id)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$payment_id | int | Required | Order (payment) ID. |
Returns string|null: Lowercase service type such as 'delivery' or 'pickup', or null for an empty ID.
Example
$type = rpress_get_service_type( $payment_id );
Defined in includes/rp-core-functions.php, line 539.
rpress_remove_view_link()#
Removes the View row action from menu items in the admin list.
Filter callback for post_row_actions; only affects the fooditem post type.
rpress_remove_view_link($actions, $post)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$actions | array | Required | Row actions. |
$post | WP_Post | Required | Current post. |
Returns array: The row actions.
Internal. Defined in includes/rp-core-functions.php, line 548.
rpress_remove_tax_view_link()#
Removes the View row action from add-on group terms in the admin list.
Filter callback for addon_category_row_actions.
rpress_remove_tax_view_link($actions, $taxonomy)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$actions | array | Required | Row actions. |
$taxonomy | WP_Term | Required | Current term. |
Returns array: The row actions.
Internal. Defined in includes/rp-core-functions.php, line 557.
rpress_remove_food_cat_view_link()#
Removes the View row action from menu categories in the admin list.
Filter callback for food-category_row_actions.
rpress_remove_food_cat_view_link($actions, $taxonomy)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$actions | array | Required | Row actions. |
$taxonomy | WP_Term | Required | Current term. |
Returns array: The row actions.
Internal. Defined in includes/rp-core-functions.php, line 566.
rp_get_store_timings()#
Returns the order time slots for a date, from opening to closing time.
Uses the store hours for the date, the order_slot_interval setting (default 30 minutes, filterable with rp_store_time_interval) and the prep_time setting. Returns an empty array when the store is closed that day or the hours are invalid. With $hide_past_time true, slots earlier than now plus prep time are dropped. Slots are formatted per the store_time_format setting. When the rpress_timing_for_today filter returns false, raw Unix timestamps are returned instead of formatted strings.
rp_get_store_timings($hide_past_time = true, $service_type = null, $service_date = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$hide_past_time | bool | true | Drop slots that are already past or within the prep time. |
$service_type | string|null | null | Service type, passed to the rp_store_time_interval filter. |
$service_date | string | '' | Date in Y-m-d; today when empty. |
Returns array: Formatted time strings, or Unix timestamps when rpress_timing_for_today is false; empty when closed.
Example
$slots = rp_get_store_timings( true, 'delivery', gmdate( 'Y-m-d' ) );
Defined in includes/rp-core-functions.php, line 579.
rp_get_current_time()#
Returns the current time in the WordPress timezone as H:i:s.
rp_get_current_time()
Returns string: Time such as '14:05:09'.
Defined in includes/rp-core-functions.php, line 646.
rpress_get_wp_timezone()#
Returns the WordPress timezone as a DateTimeZone object.
Uses wp_timezone() when available; otherwise builds a zone from the timezone_string option, then from the gmt_offset option, and falls back to UTC.
rpress_get_wp_timezone()
Returns DateTimeZone: The site timezone.
Defined in includes/rp-core-functions.php, line 657.
rpress_get_wp_now()#
Returns the current date and time in the WordPress timezone.
rpress_get_wp_now()
Returns DateTimeImmutable: Current time in the site timezone.
Example
$today = rpress_get_wp_now()->format( 'Y-m-d' );
Defined in includes/rp-core-functions.php, line 696.
rpress_parse_wp_datetime()#
Parses a date or time string as a moment in the WordPress timezone.
A Y-m-d string is read as midnight. Other strings are tried against the site date and time formats and several common formats, then against the DateTimeImmutable constructor and strtotime().
rpress_parse_wp_datetime($date_time)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$date_time | string | Required | Date or time string. |
Returns DateTimeImmutable|false: The parsed date, or false for an empty or unparseable string.
Example
$dt = rpress_parse_wp_datetime( '2026-03-05 18:30' );
Defined in includes/rp-core-functions.php, line 718.
rpress_get_wp_timestamp()#
Converts a date or time string in the WordPress timezone to a Unix timestamp.
Uses rpress_parse_wp_datetime() for parsing.
rpress_get_wp_timestamp($date_time)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$date_time | string | Required | Date or time string. |
Returns int|false: Unix timestamp, or false if it cannot be parsed.
Example
$timestamp = rpress_get_wp_timestamp( '2026-03-05 18:30' );
Defined in includes/rp-core-functions.php, line 787.
rp_current_date()#
Returns the current date formatted in the WordPress timezone.
Uses the site date_format option when no format is given. The result is passed through the rpress_current_date filter.
rp_current_date($format = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$format | string | '' | PHP date format; defaults to the site date format. |
Returns string: Formatted date.
Defined in includes/rp-core-functions.php, line 798.
rpress_local_date()#
Returns a date string reformatted with the site date format.
The format can be changed with the rpress_date_format filter. If the input cannot be parsed it is returned unchanged. The result is passed through the rpress_local_date filter.
rpress_local_date($date)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$date | string | Required | Date string. |
Returns string: Localized date.
Defined in includes/rp-core-functions.php, line 810.
rpress_format_service_date()#
Formats a Y-m-d service date with the site date format.
Returns an empty string for empty input and the original value when it cannot be parsed.
rpress_format_service_date($date)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$date | string | Required | Date in Y-m-d. |
Returns string: Formatted date.
Defined in includes/rp-core-functions.php, line 825.
rpress_format_service_time()#
Formats a service time with the site time format.
Values containing 'ASAP' keep their text, with the word translated. If $service_date is given, it is combined with the time before parsing. Unparseable input is returned unchanged; empty input returns an empty string.
rpress_format_service_time($service_time, $service_date = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_time | string | Required | Raw service time. |
$service_date | string | '' | Optional date in Y-m-d. |
Returns string: Formatted time.
Example
echo esc_html( rpress_format_service_time( '18:30', '2026-03-05' ) );
Defined in includes/rp-core-functions.php, line 849.
rpress_get_categories()#
Returns menu category terms for the food-category taxonomy.
Accepts get_terms() arguments. A comma-separated ids becomes an include list ordered by that list, and excluded_category (term ids or slugs, comma separated) becomes an exclude list. Defaults are hide_empty true, ordered by name ascending. The final arguments go through the rpress_get_categories filter.
rpress_get_categories($params = array())
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$params | array | array() | get_terms() arguments plus ids and excluded_category. |
Returns array|WP_Error: Result of get_terms(): term objects, or a WP_Error.
Example
$categories = rpress_get_categories( array( 'hide_empty' => false ) );
foreach ( $categories as $category ) {
echo esc_html( $category->name ) . "\n";
}
Defined in includes/rp-core-functions.php, line 874.
rpress_get_service_types()#
Returns the service types as slug to label.
Contains 'delivery' and 'pickup' and is filterable with rpress_service_type.
rpress_get_service_types()
Returns array: Slug to label.
Defined in includes/rp-core-functions.php, line 914.
rpress_get_enabled_services()#
Returns the slugs of the enabled service types.
Based on the enable_service setting; 'delivery_and_pickup' (the default) gives delivery and pickup. Filterable with rpress_enable_services. The result is always non-empty.
rpress_get_enabled_services()
Returns array: List of service slugs.
Example
if ( in_array( 'pickup', rpress_get_enabled_services(), true ) ) {
// Pickup is available.
}
Defined in includes/rp-core-functions.php, line 928.
rpress_get_default_enabled_service()#
Returns the service slug selected by default.
When both services are on, the default_service setting is used if it is enabled; otherwise the single enabled service or the first enabled one.
rpress_get_default_enabled_service()
Returns string: Service slug.
Defined in includes/rp-core-functions.php, line 953.
rpress_get_enabled_service_types()#
Returns the enabled service types as slug to label.
Labels come from rpress_get_service_types(), with rpress_service_label() as a fallback. Filterable with rpress_enabled_service_types.
rpress_get_enabled_service_types()
Returns array: Slug to label.
Defined in includes/rp-core-functions.php, line 976.
rp_get_store_service_hours()#
Prints <option> elements for the time slots of a service type and date.
Builds the slots with rp_get_store_timings() and the rpress_store_timings filter, optionally adds an ASAP option (enable_asap_option setting), and keeps a selected time that is no longer a slot. With $current_time_aware true, past slots on the current day are skipped. Prints nothing when $service_type is empty or there are no slots.
rp_get_store_service_hours( $service_type, $current_time_aware = true, $selected_time = null, $asap_option = null, $service_date = null )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type | string | Required | Service type slug. |
$current_time_aware | bool | true | Skip slots that are already past today. |
$selected_time | string|null | null | Time to mark as selected. |
$asap_option | mixed | null | Unused; the enable_asap_option setting is read instead. |
$service_date | string|null | null | Date in Y-m-d; today when empty. |
Example
echo '<select name="service_time">';
rp_get_store_service_hours( 'delivery', true );
echo '</select>';
Note: Echoes output instead of returning it.
Defined in includes/rp-core-functions.php, line 1004.
rpress_get_child_cats()#
Returns child food categories of a parent, or the given categories themselves when there are none.
Treats the first element of $category as the parent term. If it has no children, returns the non-empty terms listed in $category.
rpress_get_child_cats($category)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$category | array | Required | Term IDs; the first is used as the parent. |
Returns array|WP_Error: Terms, as returned by get_terms().
Defined in includes/rp-core-functions.php, line 1138.
rpress_fooditem_update_messages()#
Sets the admin notice messages for the menu item post type.
Filter callback for post_updated_messages.
rpress_fooditem_update_messages($messages)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$messages | array | Required | Messages keyed by post type. |
Returns array: The messages.
Internal. Defined in includes/rp-core-functions.php, line 1157.
rp_selected()#
Returns the selected attribute when a value matches a scalar or any item of an array.
Values are compared as strings.
rp_selected($value, $options)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$value | string|int | Required | Value to test. |
$options | string|int|array | Required | Option or list of options. |
Returns string: The selected attribute markup from WordPress selected(), or an empty string.
Example
echo '<option value="pickup"' . rp_selected( 'pickup', array( 'pickup', 'delivery' ) ) . '>Pickup</option>';
Defined in includes/rp-core-functions.php, line 1188.
rpress_selected_service()#
Returns the service type stored in the customer's cookie.
Reads the service_type cookie. With $type set to 'label', returns the label from rpress_service_label().
rpress_selected_service($type = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$type | string | '' | Pass 'label' to get the label. |
Returns string: Service slug or label; empty when no cookie is set.
Defined in includes/rp-core-functions.php, line 1203.
rpress_service_label()#
Returns the display label for a service type slug.
Known slugs are delivery and pickup; the list is filterable with rpress_service_types. An unknown slug is returned unchanged.
rpress_service_label($service)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service | string | Required | Service type slug. |
Returns string: Label, or the slug if unknown.
Example
echo esc_html( rpress_service_label( 'pickup' ) );
Defined in includes/rp-core-functions.php, line 1218.
rpress_checkout_delivery_type()#
Sets the service type and time in the current request's cookie data.
Assigns $_COOKIE['service_type'] and $_COOKIE['service_time'] for the rest of the request. It does not send a cookie to the browser.
rpress_checkout_delivery_type($service_type, $service_time)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type | string | Required | Service type slug. |
$service_time | string | Required | Service time. |
Note: Only changes the $_COOKIE superglobal for the current request; no cookie is set.
Internal. Defined in includes/rp-core-functions.php, line 1239.
rpress_get_available_service_slots()#
Returns the order time slots available for a service type and date.
Returns an empty array for an empty service type or a past date. Slots come from rp_get_store_timings() and the rpress_store_timings filter, with each slot passed through rpress_store_delivery_timings_slot_remaining. Past times are hidden only when the date is today and $hide_past_time is true. Duplicates and empty slots are removed.
rpress_get_available_service_slots( $service_type, $service_date = '', $hide_past_time = true )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type | string | Required | Service type slug. |
$service_date | string | '' | Date in Y-m-d; today when empty. |
$hide_past_time | bool | true | Hide slots already past today. |
Returns array: List of slot strings.
Example
$slots = rpress_get_available_service_slots( 'pickup', gmdate( 'Y-m-d' ) );
Defined in includes/rp-core-functions.php, line 1254.
rpress_get_first_available_service_date()#
Returns the first date on which the store can take orders for a service type.
Without a pre-order extension (rpress_is_preorder_enabled()) it always returns today. With pre-ordering, it checks each day from the requested date, up to $lookahead_days ahead, for an open store and at least one slot, and returns the first match; if none is found it returns the start date.
rpress_get_first_available_service_date( $service_type, $requested_date = '', $lookahead_days = 30 )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type | string | Required | Service type slug. |
$requested_date | string | '' | Starting date in Y-m-d; today when empty. |
$lookahead_days | int | 30 | How many days ahead to search. |
Returns string: Date in Y-m-d.
Defined in includes/rp-core-functions.php, line 1313.
rpress_get_selected_service_date()#
Returns the service date to show, never earlier than today.
Past dates become today. A future date is kept only when $allow_future is true and pre-ordering is enabled for the service type; otherwise it becomes today.
rpress_get_selected_service_date( $service_type, $requested_date = '', $allow_future = true )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type | string | Required | Service type slug. |
$requested_date | string | '' | Date in Y-m-d; today when empty. |
$allow_future | bool | true | Keep future dates when pre-ordering is on. |
Returns string: Date in Y-m-d.
Defined in includes/rp-core-functions.php, line 1367.
rpress_match_service_time_to_slot()#
Finds the slot that matches a requested service time.
Tries an exact match, a case-insensitive match, then a match by parsed timestamp. A value starting with 'ASAP' is returned as is when $allow_asap is true.
rpress_match_service_time_to_slot( $requested_time, array $available_slots, $allow_asap = false )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$requested_time | string | Required | Requested time. |
$available_slots | array | Required | Slots to match against. |
$allow_asap | bool | false | Accept ASAP values. |
Returns string: The matching slot, or an empty string.
Defined in includes/rp-core-functions.php, line 1402.
rpress_get_next_available_service_time()#
Returns the first slot that is not earlier than a minimum time.
Slots are parsed together with $service_date. Without a minimum timestamp, the first slot is returned. Returns an empty string when no slot qualifies.
rpress_get_next_available_service_time( $service_date, array $available_slots, $minimum_timestamp = 0 )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_date | string | Required | Date in Y-m-d. |
$available_slots | array | Required | Slots in order. |
$minimum_timestamp | int | 0 | Earliest allowed Unix timestamp. |
Returns string: Slot string, or an empty string.
Defined in includes/rp-core-functions.php, line 1444.
rpress_pre_validate_order()#
Validates the service type, date, time and minimum order amount before checkout.
Reads the rpress_service_type, rpress_service_date and rpress_service_time POST fields, falling back to the service_type, service_date and service_time cookies. It sets those cookies (and delivery_date, service_time_text) for 30 days when appropriate. It returns an error array when the service type is invalid, the store is closed, no time slot is available, the cart subtotal is below the configured minimum, or (with a time limit extension) the chosen slot is gone.
rpress_pre_validate_order()
Returns array: array( 'status' => 'success' ) or array( 'status' => 'error', 'error_msg' => ..., plus 'error_type' or 'minimum_price' in some cases ).
Note: Sends cookies, so it must run before output is sent.
Internal. Defined in includes/rp-core-functions.php, line 1473.
rpress_is_test_mode()#
Checks whether the store is in test mode.
Reads the test_mode setting; the result is passed through the rpress_is_test_mode filter.
rpress_is_test_mode()
Returns bool: True in test mode.
Example
if ( rpress_is_test_mode() ) {
// Use sandbox credentials.
}
Defined in includes/rp-core-functions.php, line 1666.
rpress_is_debug_mode()#
Checks whether debug mode is on.
True when the debug_mode setting is on or the RPRESS_DEBUG_MODE constant is true. The result is passed through the rpress_is_debug_mode filter.
rpress_is_debug_mode()
Returns bool: True in debug mode.
Defined in includes/rp-core-functions.php, line 1677.
rpress_no_guest_checkout()#
Checks whether guest checkout is disabled.
Returns true when the login_method setting is 'login_only'. The result is passed through the rpress_no_guest_checkout filter.
rpress_no_guest_checkout()
Returns bool: True when customers must log in; false when guest checkout is allowed.
Example
if ( rpress_no_guest_checkout() ) {
// Require login before checkout.
}
Note: The docblock states the opposite: the function returns true when guest checkout is NOT allowed.
Defined in includes/rp-core-functions.php, line 1691.
rpress_straight_to_checkout()#
Checks whether the store redirects to checkout right after an item is added to the cart.
Reads the redirect_on_add setting (default false). The result is passed through the rpress_straight_to_checkout filter.
rpress_straight_to_checkout()
Returns bool: True when redirect-on-add is enabled.
Defined in includes/rp-core-functions.php, line 1703.
rpress_is_cc_verify_enabled()#
Checks whether credit card number verification should be applied, based on the enabled gateways.
Returns true by default. Returns false when exactly one gateway is enabled and it is PayPal or Manual, or when exactly two are enabled and they are PayPal and Manual. The result is passed through the rpress_verify_credit_cards filter.
rpress_is_cc_verify_enabled()
Returns bool: True when card verification should be used.
Internal. Defined in includes/rp-core-functions.php, line 1714.
is_restropress_page()#
Checks whether the current page is a RestroPress page.
Returns true when the current post is the menu, checkout or success page set in settings, or its content or Elementor data contains a RestroPress shortcode, or it contains one of the RestroPress blocks (rpress/food-menu, rpress/checkout, rpress/order-history, rpress/receipt, rpress/food-search). Uses the global $post, falling back to the queried object. The result is passed through the is_a_restropress_page filter.
is_restropress_page()
Returns bool: True when the current page is a RestroPress page.
Example
if ( is_restropress_page() ) {
wp_enqueue_style( 'my-rpress-tweaks', plugins_url( 'tweaks.css', __FILE__ ) );
}
Note: Call it after the main query has run, for example inside wp_enqueue_scripts.
Defined in includes/rp-core-functions.php, line 1734.
rpress_post_has_shortcode_content()#
Checks whether a post contains a shortcode in its content or in its Elementor data.
Returns true if has_shortcode() matches the post content, or if the _elementor_data meta contains the opening [shortcode text.
rpress_post_has_shortcode_content( $post, $shortcode )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$post | WP_Post | Required | Post object. A non-object returns false. |
$shortcode | string | Required | Shortcode tag without brackets. |
Returns bool: True when the shortcode is found.
Example
$post = get_post( 123 );
if ( rpress_post_has_shortcode_content( $post, 'fooditems' ) ) {
// The page shows the menu.
}
Defined in includes/rp-core-functions.php, line 1801.
rpress_is_odd()#
Checks whether an integer is odd.
rpress_is_odd($int)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$int | int | Required | The integer to check. |
Returns bool: True when the value is odd.
Defined in includes/rp-core-functions.php, line 1827.
rpress_get_file_extension()#
Returns the part of a filename after the last dot.
Splits the string on dots and returns the last segment. If there is no dot, the whole string is returned.
rpress_get_file_extension($str)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$str | string | Required | File name. |
Returns string: The extension without the dot, or the whole input when it has no dot.
Defined in includes/rp-core-functions.php, line 1842.
rpress_string_is_image_url()#
Checks whether a filename or URL ends in an image extension.
Only the extensions jpg, png and gif are recognised (case-insensitive). The result is passed through the rpress_string_is_image filter.
rpress_string_is_image_url($str)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$str | string | Required | File name or URL. |
Returns bool: True when the extension is jpg, png or gif.
Note: jpeg, webp and svg are not recognised unless added through the filter.
Defined in includes/rp-core-functions.php, line 1854.
rpress_get_ip()#
Returns the IP address of the current visitor.
Checks HTTP_CLIENT_IP, then the first entry of HTTP_X_FORWARDED_FOR, then REMOTE_ADDR, and falls back to 127.0.0.1. The result is passed through the rpress_get_ip filter.
rpress_get_ip()
Returns string: The visitor IP address.
Note: The proxy headers are client-controlled and can be spoofed, so do not use the value for access control.
Defined in includes/rp-core-functions.php, line 1881.
rpress_get_host()#
Returns the name of the web host the site runs on, when it can be detected.
Detects a few known hosts from constants, the DB_HOST value or the server name. When none match it returns a diagnostic string of the form DBH: <DB_HOST>, SRV: <SERVER_NAME>.
rpress_get_host()
Returns string: Host name, or a diagnostic string when the host is unknown.
Internal. Defined in includes/rp-core-functions.php, line 1908.
rpress_is_host()#
Checks whether the site is running on a named web host.
The name is lowercased and spaces are removed before matching. Recognised values are wpengine, pagely, icdsoft, networksolutions, ipage, ipower, mediatemplegrid, pairnetworks, rackspacecloud, sysfix.eu, sysfix.eupowerhosting and flywheel.
rpress_is_host($host = false)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$host | string|false | false | Host name to test. |
Returns bool: True when the host matches. False when no host is given or the name is not recognised.
Internal. Defined in includes/rp-core-functions.php, line 1946.
rpress_get_currencies()#
Returns the list of currencies RestroPress supports.
The array maps a currency code to a translated label that includes the symbol as an HTML entity. The list is passed through the rpress_currencies filter, so extensions can add currencies.
rpress_get_currencies()
Returns array: Associative array of currency code => label.
Example
$currencies = rpress_get_currencies();
foreach ( $currencies as $code => $label ) {
echo esc_html( $code ) . ': ' . wp_kses_post( $label ) . "\n";
}
Note: Labels contain HTML entities (for example €), so decode or escape with wp_kses_post() when printing.
Defined in includes/rp-core-functions.php, line 2009.
rpress_get_currency()#
Returns the currency code set in the store settings.
Reads the currency option, default USD, and passes it through the rpress_currency filter.
rpress_get_currency()
Returns string: Currency code such as USD.
Example
$code = rpress_get_currency();
Defined in includes/rp-core-functions.php, line 2061.
rpress_currency_symbol()#
Returns the symbol for a currency code, defaulting to the store currency.
If $currency is empty, the store currency is used. Codes without a mapped symbol return the code itself. The result is passed through the rpress_currency_symbol filter with the symbol and the currency.
rpress_currency_symbol($currency = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$currency | string | '' | Currency code. Empty uses the store currency. |
Returns string: The decoded symbol, or the currency code when no symbol is mapped.
Example
echo esc_html( rpress_currency_symbol() );
echo esc_html( rpress_currency_symbol( 'EUR' ) );
Defined in includes/rp-core-functions.php, line 2074.
rpress_get_currency_name()#
Returns the label of a currency from the supported list.
Looks the code up in rpress_get_currencies() and returns the code itself if it is not listed. The result is passed through the rpress_currency_name filter.
rpress_get_currency_name($code = 'USD')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$code | string | 'USD' | Currency code. |
Returns string: The currency label, which may contain HTML entities, or the code when not found.
Defined in includes/rp-core-functions.php, line 2186.
rpress_month_num_to_name()#
Returns the short, localised month name for a month number.
rpress_month_num_to_name($n)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$n | int | Required | Month number from 1 to 12. |
Returns string: Three-letter month name from date_i18n(), for example Jan.
Defined in includes/rp-core-functions.php, line 2202.
rpress_get_php_arg_separator_output()#
Returns the PHP arg_separator.output setting.
rpress_get_php_arg_separator_output()
Returns string|false: Value of ini setting arg_separator.output, or false if the setting does not exist.
Internal. Defined in includes/rp-core-functions.php, line 2213.
rpress_get_current_page_url()#
Returns the URL of the page being viewed.
Builds the URL from the current request. On the front page it returns the home URL, and on the checkout page it returns the checkout URI. The result is passed through the rpress_get_current_page_url filter. With $nocache true it is run through rpress_add_cache_busting().
rpress_get_current_page_url($nocache = false)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$nocache | bool | false | Whether to add the nocache query argument when caching applies. |
Returns string: The current page URL.
Example
$url = rpress_get_current_page_url();
Defined in includes/rp-core-functions.php, line 2224.
rpress_add_cache_busting()#
Adds a nocache query argument to a URL when a caching plugin is active or checkout is set to no-cache.
Adds nocache=true if a caching plugin is detected, or if the current page is checkout and the no_cache_checkout setting is on. Otherwise the URL is returned unchanged.
rpress_add_cache_busting($url = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$url | string | '' | URL to modify. |
Returns string: The URL with or without the nocache argument.
Internal. Defined in includes/rp-core-functions.php, line 2253.
_rpress_deprecated_function()#
Flags a function as deprecated and optionally triggers a PHP notice.
Fires the rpress_deprecated_function_run action with the function name, replacement and version. When WP_DEBUG is on and the rpress_deprecated_function_trigger_error filter (default: current user has manage_options) is true, it calls trigger_error() with a message, followed by the backtrace.
_rpress_deprecated_function($function, $version, $replacement = null, $backtrace = null)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$function | string | Required | Name of the deprecated function. |
$version | string | Required | RestroPress version that deprecated it. |
$replacement | string|null | null | Function to use instead. |
$backtrace | array|null | null | Backtrace to print with the notice. |
Example
function my_old_helper() {
_rpress_deprecated_function( __FUNCTION__, '1.0.0', 'my_new_helper' );
return my_new_helper();
}
Defined in includes/rp-core-functions.php, line 2282.
_rpress_deprected_argument()#
Flags a function argument as deprecated and optionally triggers a PHP notice.
The name is spelled this way in the source. Fires the rpress_deprecated_argument_run action. When WP_DEBUG is on and the rpress_deprecated_argument_trigger_error filter (default: current user has manage_options) is true, it calls trigger_error() with a message, followed by the backtrace.
_rpress_deprected_argument($argument, $function, $version, $replacement = null, $backtrace = null)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$argument | string | Required | Name of the deprecated argument. |
$function | string | Required | Function that was called. |
$version | string | Required | RestroPress version that deprecated the argument. |
$replacement | string|null | null | Replacement to use instead. |
$backtrace | array|null | null | Backtrace to print with the notice. |
Note: The function name contains a typo (deprected) and must be called exactly as spelled.
Defined in includes/rp-core-functions.php, line 2332.
rpress_is_func_disabled()#
Checks whether a PHP function is listed in disable_functions.
Compares the name against the comma-separated disable_functions ini value. Whitespace around entries is not trimmed.
rpress_is_func_disabled($function)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$function | string | Required | Function name. |
Returns bool: True when the function is in the disabled list.
Example
if ( ! rpress_is_func_disabled( 'set_time_limit' ) ) {
set_time_limit( 0 );
}
Defined in includes/rp-core-functions.php, line 2370.
rpress_let_to_num()#
Converts a PHP shorthand size string such as 128M into a number.
Takes the last character as the unit and multiplies the leading number by 1024 for K, M, G, T or P.
rpress_let_to_num($v)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$v | string | Required | Size string, for example 128M. |
Returns int: Numeric value after conversion.
Note: The multiplier is always 1024 regardless of the unit, so 128M returns 131072, not bytes.
Defined in includes/rp-core-functions.php, line 2387.
rpress_get_symlink_url()#
Returns the URL of the RestroPress symlink directory in the uploads folder.
Creates the rpress/symlinks directory in uploads if it does not exist. The result is passed through the rpress_get_symlink_url filter.
rpress_get_symlink_url()
Returns string: Symlink directory URL.
Internal. Defined in includes/rp-core-functions.php, line 2410.
rpress_get_symlink_dir()#
Returns the absolute path to the RestroPress symlink directory in the uploads folder.
Creates the rpress/symlinks directory in uploads if it does not exist. The result is passed through the rpress_get_symlink_dir filter.
rpress_get_symlink_dir()
Returns string: Symlink directory path.
Internal. Defined in includes/rp-core-functions.php, line 2423.
rpress_get_upload_dir()#
Returns the absolute path to the RestroPress folder in the uploads directory.
Creates the rpress directory in uploads if it does not exist. The path has no trailing slash. The result is passed through the rpress_get_upload_dir filter.
rpress_get_upload_dir()
Returns string: Upload directory path.
Example
$dir = rpress_get_upload_dir();
file_put_contents( $dir . '/export.csv', $csv );
Defined in includes/rp-core-functions.php, line 2436.
rpress_cleanup_file_symlinks()#
Deletes symlink files in the symlink directory whose transient has expired.
Hooked to the rpress_cleanup_file_symlinks action. It returns immediately unless WordPress cron is running.
rpress_cleanup_file_symlinks()
Internal. Defined in includes/rp-core-functions.php, line 2451.
rpress_use_skus()#
Checks whether SKUs are enabled in the settings.
Reads the enable_skus option and passes it through the rpress_use_skus filter.
rpress_use_skus()
Returns bool: True when SKUs are enabled.
Defined in includes/rp-core-functions.php, line 2475.
rpress_get_timezone_id()#
Returns the site timezone identifier.
Uses the timezone_string option if set. Otherwise it tries to derive a timezone from gmt_offset, and returns UTC if that fails or the offset is zero.
rpress_get_timezone_id()
Returns string: Timezone ID such as Europe/London, or UTC.
Example
$tz = new DateTimeZone( rpress_get_timezone_id() );
Defined in includes/rp-core-functions.php, line 2486.
rpress_object_to_array()#
Recursively converts an object, or an array of objects, to arrays.
Empty values and scalars are returned unchanged. Objects become arrays through get_object_vars(), and nested objects are converted too. An RPRESS_Payment object is converted with its array_convert() method.
rpress_object_to_array($object = array())
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$object | object|array | array() | Object or array of objects. |
Returns array|mixed: The converted array, or the original value if it is empty or not an object or array.
Defined in includes/rp-core-functions.php, line 2517.
rpress_set_upload_dir()#
Filters the upload directory so files go under the rpress subfolder.
Callback for the upload_dir filter, added by the admin upload handler. Prefixes the subdirectory with /rpress and rebuilds path and url. If year/month folders are enabled, they use the current date.
rpress_set_upload_dir($upload)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$upload | array | Required | Upload directory data from wp_upload_dir(). |
Returns array: Modified upload directory data.
Internal. Defined in includes/rp-core-functions.php, line 2554.
rpress_has_upgrade_completed()#
Checks whether an upgrade routine has been recorded as completed.
Looks for the action name in the rpress_completed_upgrades option. An empty name returns false.
rpress_has_upgrade_completed($upgrade_action = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$upgrade_action | string | '' | Upgrade action name. |
Returns bool: True when the action is in the completed list.
Internal. Defined in includes/rp-core-functions.php, line 2576.
rpress_get_completed_upgrades()#
Returns the list of completed upgrade actions.
Reads the rpress_completed_upgrades option and returns an empty array when it is not set.
rpress_get_completed_upgrades()
Returns array: Completed upgrade action names.
Internal. Defined in includes/rp-core-functions.php, line 2590.
cal_days_in_month()#
Fallback returning the number of days in a month when the PHP calendar extension is missing.
Defined only if cal_days_in_month does not already exist. Supports the Gregorian calendar only and ignores $calendar.
cal_days_in_month($calendar, $month, $year)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$calendar | int | Required | Calendar type. Ignored. |
$month | int | Required | Month number. |
$year | int | Required | Year. |
Returns string: Number of days in the month, as returned by gmdate('t').
Internal. Defined in includes/rp-core-functions.php, line 2601.
hash_equals()#
Fallback comparing two strings in constant time on old PHP versions.
Defined only if hash_equals does not already exist. Returns false at once when lengths differ, so length can leak.
hash_equals($a, $b)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$a | string | Required | Expected string. |
$b | string | Required | Actual string. |
Returns bool: True when the strings are equal.
Internal. Defined in includes/rp-core-functions.php, line 2619.
getallheaders()#
Fallback returning the request headers when the server does not provide getallheaders().
Defined only if getallheaders does not already exist, for example on nginx with PHP-FPM. Builds the array from HTTP_ entries in $_SERVER.
getallheaders()
Returns array: Header name => value.
Internal. Defined in includes/rp-core-functions.php, line 2642.
rpress_can_view_receipt()#
Checks whether the current visitor may view the receipt for a purchase key.
Grants access to the logged-in order owner, a user whose email matches the order email, or a user with the view_shop_sensitive_data capability. Guests are allowed when the order is a guest order and the purchase key matches the session key or the supplied key. The result is passed through the rpress_can_view_receipt filter.
rpress_can_view_receipt($payment_key = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$payment_key | string | '' | Purchase key of the order. Empty returns false. |
Returns bool: True when the receipt can be viewed.
Note: Side effect: sets $rpress_receipt_args['id'] in the global scope to the order ID.
Defined in includes/rp-core-functions.php, line 2658.
rpress_payment_get_ip_address_url()#
Returns an HTML link to ipinfo.io for the IP address stored on an order.
Loads the order with RPRESS_Payment and builds an anchor to https://ipinfo.io/ plus the IP. The result is passed through the rpress_payment_get_ip_address_url filter with the link, the IP and the order ID.
rpress_payment_get_ip_address_url($payment_id)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$payment_id | int | Required | Order (payment) ID. |
Returns string: HTML anchor element.
Internal. Defined in includes/rp-core-functions.php, line 2694.
rpress_doing_cron()#
Checks whether WordPress cron is currently running.
Returns true when wp_doing_cron() is true or the DOING_CRON constant is true.
rpress_doing_cron()
Returns bool: True during a cron request.
Note: The docblock says the function may later be limited to RestroPress jobs only.
Internal. Defined in includes/rp-core-functions.php, line 2711.
rp_help_tip()#
Returns the markup for a RestroPress help tip icon.
Returns a span with the class restropress-help-tip and the text in a data-tip attribute. With $allow_html true the tip goes through rpress_sanitize_tooltip(), otherwise through esc_attr().
rp_help_tip($tip, $allow_html = false)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$tip | string | Required | Help tip text. |
$allow_html | bool | false | Allow sanitized HTML in the tip. |
Returns string: HTML span element.
Example
echo rp_help_tip( __( 'Shown to customers at checkout.', 'my-plugin' ) );
Note: Returns the markup. Echo it yourself.
Defined in includes/rp-core-functions.php, line 2732.
rpress_is_service_enabled()#
Checks whether a service type, such as delivery or pickup, is enabled.
Sanitizes the key and looks it up in rpress_get_enabled_service_types(). The result is passed through the rpress_is_service_enabled filter with the service key and the enabled types.
rpress_is_service_enabled($service)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service | string | Required | Service type key, for example delivery or pickup. |
Returns bool: True when the service type is enabled.
Example
if ( rpress_is_service_enabled( 'delivery' ) ) {
// Show delivery options.
}
Defined in includes/rp-core-functions.php, line 2747.
rpress_fooditem_available()#
Checks whether a menu item can be ordered.
Returns true unless the rpress_is_orderable filter, which receives the default true and the menu item ID, returns a falsy value.
rpress_fooditem_available($fooditem_id)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$fooditem_id | int | Required | Menu item ID. |
Returns bool: True when the item is orderable.
Example
if ( rpress_fooditem_available( 42 ) ) {
// Show the add to cart button.
}
Defined in includes/rp-core-functions.php, line 2755.
rp_get_label_singular()#
Returns the singular label for menu items.
Based on rp_get_default_labels(), which the rp_default_fooditems_name filter can change.
rp_get_label_singular($lowercase = false)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$lowercase | bool | false | Return the label in lowercase. |
Returns string: Singular label, by default Menu Item.
Defined in includes/rp-core-functions.php, line 2765.
rp_get_label_plural()#
Returns the plural label for menu items.
Based on rp_get_default_labels(), which the rp_default_fooditems_name filter can change.
rp_get_label_plural($lowercase = false)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$lowercase | bool | false | Return the label in lowercase. |
Returns string: Plural label, by default Menu Items.
Defined in includes/rp-core-functions.php, line 2776.
rp_get_default_labels()#
Returns the default singular and plural labels for menu items.
The array has the keys singular and plural. It is passed through the rp_default_fooditems_name filter.
rp_get_default_labels()
Returns array: Array with singular and plural labels.
Defined in includes/rp-core-functions.php, line 2787.
rpress_get_fooditem_icon()#
Returns an img tag for the food type icon of a menu item.
Reads the rpress_food_type post meta and builds an image from the plugin's assets/images folder, using the rpress_food_type_icon filter for the URL. If $id is empty, the current post ID is used.
rpress_get_fooditem_icon($id = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$id | int|string | '' | Menu item ID. Empty uses get_the_ID(). |
Returns string|null: HTML img element, or null when the item has no food type.
Example
echo rpress_get_fooditem_icon( 42 );
Note: Returns the markup and does not escape the URL. No return value when the food type is empty.
Defined in includes/rp-core-functions.php, line 2801.
rpress_default_notification_sound()#
Supplies the bundled new-order sound when no notification sound is set.
Filter callback on rpress_get_option_notification_sound. When the stored value is false, null or an empty string, it returns the plugin's assets/sounds/new-order.wav URL, filterable with rpress_default_notification_sound.
rpress_default_notification_sound($value, $key, $default)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$value | mixed | Required | Stored option value. |
$key | string | Required | Option key. |
$default | mixed | Required | Default passed to rpress_get_option(). |
Returns mixed: The stored value, or the default sound URL when it is empty.
Internal. Defined in includes/rp-core-functions.php, line 2824.
rp_get_checkout_fields()#
Returns the delivery address fields shown at checkout, with current values filled in.
Builds four fields (street address, apt/suite, city, postcode) and pre-fills them from the session customer data and, for logged-in users, the _rpress_user_delivery_address user meta. The address values pass through the rpress_customer_delivery_address filter and the field list through the rpress_checkout_fields filter.
rp_get_checkout_fields()
Returns array: Field definitions keyed by field name, each with id, title, is_required, is_hidden, name, placeholder and value.
Example
$fields = rp_get_checkout_fields();
foreach ( $fields as $key => $field ) {
echo esc_html( $field['title'] ) . ' required: ' . ( $field['is_required'] ? 'yes' : 'no' ) . "\n";
}
Defined in includes/rp-core-functions.php, line 2838.
my_plugin_handle_setup_form()#
Saves the service settings from the setup screen on admin_init.
Runs on the rpress-setup admin page when the my_plugin_setup_nonce nonce is valid. Updates enable_service and default_service in the rpress_settings option, then redirects to the admin URL and exits.
my_plugin_handle_setup_form()
Internal. Defined in includes/rp-core-functions.php, line 2902.
rpress_is_store_open()#
Checks whether the store is open for a service type on a given date.
Uses the store hours for the date, the always-open setting, holidays and overnight windows. Today is tested against the current time. Future dates are open only if pre-order is enabled for the service and the day has hours. Past dates are closed. The result is passed through the rpress_is_store_open filter.
rpress_is_store_open($service_type, $selected_date = '')
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type | string | Required | Service type key, for example delivery or pickup. |
$selected_date | string | '' | Date as Y-m-d. Empty uses today. |
Returns bool: True when the store is open.
Example
if ( ! rpress_is_store_open( 'delivery' ) ) {
echo esc_html( rpress_store_closed_message( 'delivery' ) );
}
Defined in includes/rp-core-functions.php, line 2940.
rpress_store_closed_message()#
Returns the message shown when the store is closed.
Reads the store_closed_msg setting, with a default of "Sorry, we are closed for ordering now." The result is passed through the rpress_store_closed_message filter.
rpress_store_closed_message($service_type)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type | string | Required | Service type key. |
Returns string: Closed message.
Example
echo esc_html( rpress_store_closed_message( 'pickup' ) );
Defined in includes/rp-core-functions.php, line 2996.
rpress_get_service_context()#
Returns the current service selection and time slot details for the visitor.
Resolves the service type from the override, the request, the service_type cookie or the default, then the date, time, delivery address, available slots and open status. Sets the service_date and delivery_date cookies when headers are not yet sent and writes both into $_COOKIE. Filters used are rpress_service_context_delivery_address and rpress_current_service_type.
rpress_get_service_context( $service_type_override = '' )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$service_type_override | string | '' | Service type to use instead of the request or cookie value. |
Returns array: Context array with keys including service_type, service_date_raw, service_date, service_time, delivery_address, selected_time, store_timings, is_store_open, service_enabled and services.
Example
$context = rpress_get_service_context();
if ( ! $context['is_store_open'] ) {
// The store cannot take orders for the selected service and date.
}
Note: Has side effects: it can set cookies and modifies $_COOKIE, so call it before output starts.
Defined in includes/rp-core-functions.php, line 3007.
rp_row_date()#
Returns the raw service date, filtered, or today when it is empty.
The input passes through the rpress_service_date_raw filter. If the result is empty, today's date in the site timezone is returned as Y-m-d.
rp_row_date($raw_date, $service_type)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$raw_date | string | Required | Raw service date. |
$service_type | string | Required | Service type key. |
Returns string: Date string, normally Y-m-d.
Internal. Defined in includes/rp-core-functions.php, line 3158.
rpress_process_profile_editor_updates()#
Saves changes submitted from the profile editor form.
Hooked to the rpress_edit_user_profile action. Checks that the user is logged in and not pending verification and that the rpress-profile-editor-nonce nonce is valid. Validates email and password, updates the user, the _rpress_user_address meta and the linked customer record, fires rpress_pre_update_user_profile and rpress_user_profile_updated, then redirects and exits.
rpress_process_profile_editor_updates( $data )
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
$data | array | Required | Submitted form data, which must include the profile editor nonce and redirect URL. |
Returns false|void: False when a precondition fails. On success or validation errors it redirects and ends the request.
Internal. Defined in includes/shortcodes.php, line 23.
rpress_process_profile_editor_remove_email()#
Removes an email address from the customer record from the profile editor link.
Hooked to the rpress_profile-remove-email action. Requires a logged-in user who is not pending verification, a valid rpress-remove-customer-email nonce in _wpnonce and a valid email query argument. Removes the email, adds a customer note, then redirects to the redirect argument and exits.
rpress_process_profile_editor_remove_email()
Returns false|void: False when a precondition fails. Otherwise redirects and ends the request.
Internal. Defined in includes/shortcodes.php, line 117.
rpress_register_widgets()#
Registers the RestroPress widgets.
Hooked to widgets_init. Registers the cart, categories and tags, and product details widget classes.
rpress_register_widgets()
Internal. Defined in includes/widgets.php, line 428.
