str_starts_with( string $haystack, string $needle )
Polyfill for str_starts_with()
function added in PHP 8.0.
Description
Performs a case-sensitive check indicating if the haystack begins with needle.
Parameters
- $haystack
-
(Required) The string to search in.
- $needle
-
(Required) The substring to search for in the
$haystack
.
Return
(bool) True if $haystack
starts with $needle
, otherwise false.
Source
File: wp-includes/compat.php
function str_starts_with( $haystack, $needle ) {
if ( '' === $needle ) {
return true;
}
return 0 === strpos( $haystack, $needle );
}
Related
Used By
Used By | Description |
---|---|
wp-admin/includes/class-wp-automatic-updater.php: WP_Automatic_Updater::is_allowed_dir() |
Checks whether access to a given directory is allowed. |
wp-admin/includes/template.php: _get_plugin_from_callback() |
Internal helper function to find the plugin from a meta box callback. |
wp-admin/includes/class-wp-site-health.php: WP_Site_Health::get_test_is_in_debug_mode() |
Tests if debug information is enabled. |
wp-admin/includes/class-wp-site-health-auto-updates.php: WP_Site_Health_Auto_Updates::test_all_files_writable() |
Checks if core files are writable by the web user/group. |
wp-includes/class-wp-recovery-mode-email-service.php: WP_Recovery_Mode_Email_Service::get_plugin() |
Return the details for a single plugin based on the extension data from an error. |
wp-includes/error-protection.php: wp_get_extension_error_description() |
Get a human readable description of an extension’s error. |
wp-includes/classicpress/class-wp-compat.php: WP_Compat::using_block_function() |
This function have to be called from a polyfill to map themes and plugins calling those functions. |
wp-includes/classicpress/class-cp-customization-frontend.php: CP_Customization_Frontend::remove_emoji_hint() | |
wp-includes/l10n.php: load_script_textdomain() |
Loads the script translated strings. |
wp-includes/class-wp-recovery-mode.php: WP_Recovery_Mode::get_extension_for_error() |
Gets the extension that the error occurred in. |
wp-includes/class-wp-recovery-mode.php: WP_Recovery_Mode::is_network_plugin() |
Checks whether the given extension a network activated plugin. |
wp-includes/script-loader.php: _wp_normalize_relative_css_links() |
Makes URLs relative to the WordPress installation. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::match_request_to_handler() |
Matches a request object to its handler. |
wp-includes/rest-api.php: rest_is_field_included() |
Given an array of fields to include in a response, some of which may be |
wp-includes/class-wp-query.php: WP_Query::generate_postdata() |
Generate post data. |
wp-includes/class-wp-textdomain-registry.php: WP_Textdomain_Registry::get_path_from_lang_dir() |
Gets the path to the language directory for the current locale. |
wp-includes/functions.php: human_readable_duration() |
Converts a duration to human readable format. |
wp-includes/deprecated.php: get_links() |
Gets the links associated with category by ID. |
wp-includes/deprecated.php: get_links_list() |
Output entire list of links by category. |
wp-includes/general-template.php: wp_admin_css() |
Enqueues or directly prints a stylesheet link to the specified CSS file. |
wp-includes/rest-api/class-wp-rest-request.php: WP_REST_Request::from_url() |
Retrieves a WP_REST_Request object from a full URL. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::get_headers() |
Extracts headers from a PHP-style $_SERVER array. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::serve_request() |
Handles serving a REST API request. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::get_compact_response_links() |
Retrieves the CURIEs (compact URIs) used for relations. |
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php: WP_REST_Attachments_Controller::get_filename_from_disposition() |
Parses filename from a Content-Disposition header value. |
wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::is_option_capture_ignored() |
Determines whether the captured option update should be ignored. |
wp-includes/class-wp-styles.php: WP_Styles::_css_href() |
Generates an enqueued style’s fully-qualified URL. |
wp-includes/class-wp-styles.php: WP_Styles::in_default_dir() |
Whether a handle’s source is in a default directory. |
wp-includes/l10n.php: get_available_languages() |
Gets all available languages based on the presence of *.mo files in a given directory. |
wp-includes/l10n.php: _load_textdomain_just_in_time() |
Loads plugin and theme text domains just-in-time. |
wp-includes/class-wp-query.php: WP_Query::parse_search() |
Generates SQL for the WHERE clause based on passed search terms. |
wp-includes/class-wp-http-encoding.php: WP_Http_Encoding::compatible_gzinflate() |
Decompression of deflated string while staying compatible with the majority of servers. |
wp-includes/class-wp-network.php: WP_Network::_set_cookie_domain() |
Sets the cookie domain based on the network domain if one has not been populated. |
wp-includes/pluggable.php: wp_validate_redirect() |
Validates a URL for use in a redirect. |
wp-includes/pluggable.php: auth_redirect() |
Checks if a user is logged in, if not it redirects them to the login page. |
wp-includes/pluggable.php: check_admin_referer() |
Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. |
wp-includes/pluggable.php: wp_mail() |
Sends an email, similar to PHP’s mail function. |
wp-includes/bookmark-template.php: _walk_bookmarks() |
The formatted output of a list of bookmarks. |
wp-includes/comment.php: discover_pingback_server_uri() |
Finds a pingback server URI based on the given URL. |
wp-includes/class-wp-embed.php: WP_Embed::delete_oembed_caches() |
Deletes all oEmbed caches. Unused by core as of 4.0.0. |
wp-includes/pomo/po.php: PO::trim_quotes() | |
wp-includes/ms-load.php: get_site_by_path() |
Retrieves the closest matching site object by its domain and path. |
wp-includes/link-template.php: set_url_scheme() |
Sets the scheme for a URL. |
wp-includes/link-template.php: plugins_url() |
Retrieves a URL within the plugins or mu-plugins directory. |
wp-includes/ms-deprecated.php: wpmu_admin_do_redirect() |
Redirect a user based on $_GET or $_POST arguments. |
wp-includes/ms-blogs.php: get_blog_details() |
Retrieves the details for a blog from the blogs table and blog options. |
wp-includes/http.php: wp_parse_url() |
A wrapper for PHP’s parse_url() function that handles consistency in the return values across PHP versions. |
wp-includes/user.php: get_blogs_of_user() |
Gets the sites a user belongs to. |
wp-includes/class-wp-theme.php: WP_Theme::sort_by_name() |
Sorts themes by name. |
wp-includes/theme.php: search_theme_directories() |
Searches all registered theme directories for complete and valid themes. |
wp-includes/theme.php: get_theme_root_uri() |
Retrieves URI for themes directory. |
wp-includes/plugin.php: plugin_basename() |
Gets the basename of a plugin. |
wp-includes/rewrite.php: url_to_postid() |
Examines a URL and try to determine the post ID it represents. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::add_state_query_params() |
Adds customize state query params to a given URL if preview is allowed. |
wp-includes/post-template.php: post_password_required() |
Determines whether the post requires password and whether a correct password has been provided. |
wp-includes/class-wp-http-cookie.php: WP_Http_Cookie::test() |
Confirms that it’s OK to send this cookie to the URL checked against. |
wp-includes/post.php: wp_attachment_is() |
Verifies an attachment is of a given type. |
wp-includes/post.php: wp_mime_type_icon() |
Retrieves the icon for a MIME type or attachment. |
wp-includes/post.php: get_pages() |
Retrieves an array of pages (or hierarchical post type items). |
wp-includes/post.php: wp_get_attachment_url() |
Retrieves the URL for an attachment. |
wp-includes/post.php: get_attached_file() |
Retrieves attached file path based on attachment ID. |
wp-includes/post.php: _wp_relative_upload_path() |
Returns relative path to an uploaded file. |
wp-includes/kses.php: safecss_filter_attr() |
Filters an inline style attribute and removes disallowed rules. |
wp-includes/kses.php: wp_kses_attr_check() |
Determines whether an attribute is allowed. |
wp-includes/kses.php: wp_kses_bad_protocol() |
Sanitizes a string and removed disallowed URL protocols. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::filter_wp_nav_menu_args() |
Keeps track of the arguments that are being passed to wp_nav_menu(). |
wp-includes/class-wp.php: WP::parse_request() |
Parses the request to find the correct WordPress query. |
wp-includes/formatting.php: wp_sprintf_l() |
Localizes list items before the rest of the content. |
wp-includes/formatting.php: wp_trim_words() |
Trims text to a certain number of words. |
wp-includes/formatting.php: iso8601_timezone_to_offset() |
Given an ISO 8601 timezone, returns its UTC offset in seconds. |
wp-includes/formatting.php: remove_accents() |
Converts all accent characters to ASCII characters. |
wp-includes/formatting.php: wptexturize() |
Replaces common plain text characters with formatted entities. |
wp-includes/class-wp-scripts.php: WP_Scripts::do_item() |
Processes a script dependency. |
wp-includes/class-wp-scripts.php: WP_Scripts::in_default_dir() |
Whether a handle’s source is in a default directory. |
wp-includes/taxonomy.php: wp_update_term_count_now() |
Performs term count update immediately. |
wp-includes/taxonomy.php: wp_get_object_terms() |
Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
wp-includes/widgets.php: wp_map_sidebars_widgets() |
Compares a list of sidebars with their widgets against an allowed list. |
wp-includes/widgets.php: is_active_widget() |
Determines whether a given widget is displayed on the front end. |
wp-includes/shortcodes.php: do_shortcodes_in_html_tags() |
Searches only inside HTML elements for shortcodes and process them. |
wp-includes/functions.php: wp_delete_file_from_directory() |
Deletes a file if its path is within the given directory. |
wp-includes/functions.php: wp_auth_check_html() |
Outputs the HTML that shows the wp-login dialog when the user is no longer logged in. |
wp-includes/functions.php: _wp_timezone_choice_usort_callback() |
Sort-helper for timezones. |
wp-includes/functions.php: wp_check_filetype_and_ext() |
Attempts to determine the real file type of a file. |
wp-includes/functions.php: wp_get_image_mime() |
Returns the real mime type of an image file. |
wp-includes/functions.php: _wp_upload_dir() |
A non-filtered, non-cached version of wp_upload_dir() that doesn’t check the path. |
wp-includes/functions.php: wp_unique_filename() |
Gets a filename that is sanitized and unique for the given directory. |
wp-includes/functions.php: wp_upload_dir() |
Returns an array containing the current upload directory’s path and URL. |
wp-includes/functions.php: wp_upload_bits() |
Creates a file in the upload folder with given content. |
wp-admin/menu-header.php: _wp_menu_output() |
Display menu. |
wp-admin/includes/deprecated.php: wp_dashboard_plugins_output() |
Display plugins text for the ClassicPress news widget. |
wp-admin/includes/class-wp-screen.php: WP_Screen::get() |
Fetches a screen object. |
wp-admin/includes/class-wp-media-list-table.php: WP_Media_List_Table::column_default() |
Handles output for the default column. |
wp-admin/includes/class-wp-media-list-table.php: WP_Media_List_Table::get_views() | |
wp-admin/includes/media.php: edit_form_image_editor() |
Displays the image and editor in the post editor |
wp-admin/includes/media.php: wp_add_id3_tag_data() |
Parses ID3v2, ID3v1, and getID3 comments to extract usable data. |
wp-admin/includes/media.php: image_media_send_to_editor() |
Retrieves the media element HTML to send to the editor. |
wp-admin/includes/media.php: get_attachment_fields_to_edit() |
Retrieves the attachment fields to edit form fields. |
wp-admin/includes/media.php: media_handle_upload() |
Saves a file submitted from a POST request and create an attachment post for it. |
wp-admin/includes/media.php: wp_iframe() |
Outputs the iframe to display the media upload page. |
wp-admin/includes/network.php: network_step1() |
Prints step 1 for Network installation process. |
wp-admin/includes/network.php: network_step2() |
Prints step 2 for Network installation process. |
wp-admin/includes/class-wp-posts-list-table.php: WP_Posts_List_Table::column_default() |
Handles the default column output. |
wp-admin/includes/class-core-upgrader.php: Core_Upgrader::check_files() |
Compare the disk file checksums against the expected checksums. |
wp-admin/includes/ajax-actions.php: wp_ajax_send_attachment_to_editor() |
Ajax handler for sending an attachment to the editor. |
wp-admin/includes/ajax-actions.php: wp_ajax_parse_embed() |
Apply [embed] Ajax handlers to a string. |
wp-admin/includes/menu.php: add_menu_classes() |
Adds CSS classes for top-level administration menu items. |
wp-admin/includes/plugin.php: get_plugins() |
Checks the plugins directory and retrieve all plugin files with plugin data. |
wp-admin/includes/privacy-tools.php: wp_privacy_generate_personal_data_export_group_html() |
Generate a single group for the personal data export report. |
wp-admin/includes/file.php: download_url() |
Downloads a URL to a local temporary file using the ClassicPress HTTP API. |
wp-admin/includes/file.php: _unzip_file_ziparchive() |
Attempts to unzip an archive using the ZipArchive class. |
wp-admin/includes/file.php: _unzip_file_pclzip() |
Attempts to unzip an archive using the PclZip library. |
wp-admin/includes/file.php: copy_dir() |
Copies a directory from one location to another via the WordPress Filesystem Abstraction. |
wp-admin/includes/file.php: _wp_handle_upload() |
Handles PHP uploads in ClassicPress. |
wp-admin/includes/class-file-upload-upgrader.php: File_Upload_Upgrader::__construct() |
Construct the upgrader for a form. |
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |