str_contains( string $haystack, string $needle )
Polyfill for str_contains()
function added in PHP 8.0.
Description
Performs a case-sensitive check indicating if needle is contained in haystack.
Parameters
- $haystack
-
(Required) The string to search in.
- $needle
-
(Required) The substring to search for in the haystack.
Return
(bool) True if $needle
is in $haystack
, otherwise false.
Source
File: wp-includes/compat.php
function str_contains( $haystack, $needle ) {
return ( '' === $needle || false !== strpos( $haystack, $needle ) );
}
Related
Used By
Used By | Description |
---|---|
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_page_cache_headers() |
Returns a list of headers and its verification callback to verify if page cache is enabled or not. |
wp-admin/includes/class-wp-site-health.php: WP_Site_Health::get_test_utf8mb4_support() |
Tests if the database server is capable of using utf8mb4. |
wp-admin/includes/class-wp-site-health-auto-updates.php: WP_Site_Health_Auto_Updates::test_accepts_dev_updates() |
Checks if the install is using a development branch and can use nightly packages. |
wp-admin/includes/theme.php: resume_theme() |
Tries to resume a single theme. |
wp-includes/https-detection.php: wp_is_local_html_output() |
Checks whether a given HTML string is likely an output from this WordPress site. |
wp-includes/classicpress/class-cp-customization.php: CP_Customization::cp_translations() |
Returns the matching ClassicPress URL. |
wp-includes/load.php: wp_is_xml_request() |
Checks whether current request is an XML request, or is expecting an XML response. |
wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php: WP_REST_Autosaves_Controller::get_items() |
Gets a collection of autosaves using wp_get_post_autosave. |
wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php: WP_REST_Plugins_Controller::create_item() |
Uploads a plugin and optionally activates it. |
wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php: WP_REST_Plugins_Controller::does_plugin_match_request() |
Checks if the plugin matches the requested parameters. |
wp-includes/functions.php: clean_dirsize_cache() |
Cleans directory size cache used by recurse_dirsize(). |
wp-includes/class-wp-query.php: WP_Query::generate_postdata() |
Generate post data. |
wp-includes/class-wp-query.php: WP_Query::generate_cache_key() |
Generate cache key. |
wp-includes/general-template.php: wp_get_code_editor_settings() |
Generates and returns code editor settings. |
wp-includes/cron.php: _wp_cron() |
Runs scheduled callbacks or spawns cron for all scheduled events. |
wp-includes/deprecated.php: wp_get_links() |
Gets the links associated with category. |
wp-includes/deprecated.php: get_links() |
Gets the links associated with category by ID. |
wp-includes/general-template.php: user_can_richedit() |
Determines whether the user can access the visual editor. |
wp-includes/general-template.php: get_bloginfo() |
Retrieves information about the current site. |
wp-includes/class-wp-user-query.php: WP_User_Query::prepare_query() |
Prepares the query variables. |
wp-includes/rest-api/class-wp-rest-request.php: WP_REST_Request::get_content_type() |
Retrieves the Content-Type of the request. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::get_data_for_route() |
Retrieves publicly-visible data for the route. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: WP_REST_Users_Controller::check_user_password() |
Check a user password for the REST API. |
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/widgets/class-wp-widget-text.php: WP_Widget_Text::is_legacy_instance() |
Determines whether a given instance is legacy and should bypass using TinyMCE. |
wp-includes/class-wp-post-type.php: WP_Post_Type::remove_rewrite_rules() |
Removes any rewrite rules, permastructs, and rules for the post type. |
wp-includes/template.php: get_attachment_template() |
Retrieves path of attachment template in current or parent template. |
wp-includes/class-wp-query.php: WP_Query::parse_query() |
Parse a query string and set query type booleans. |
wp-includes/class-wp-query.php: WP_Query::parse_tax_query() |
Parses various taxonomy related query vars. |
wp-includes/class-wp-query.php: WP_Query::get_posts() |
Retrieves an array of posts based on query variables. |
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: 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: check_comment() |
Checks whether a comment passes internal checks to be allowed to add. |
wp-includes/class-wp-date-query.php: WP_Date_Query::validate_column() |
Validates a column name parameter. |
wp-includes/vars.php: wp_is_mobile() |
Test if the current browser runs on a mobile device (smart phone, tablet, etc.) |
wp-includes/pomo/po.php: PO::poify() |
Formats a string in PO-style |
wp-includes/class-wp-meta-query.php: WP_Meta_Query::get_sql() |
Generates SQL clauses to be appended to a main query. |
wp-includes/link-template.php: get_avatar_data() |
Retrieves default data about the avatar. |
wp-includes/link-template.php: get_adjacent_post() |
Retrieves the adjacent post. |
wp-includes/link-template.php: get_feed_link() |
Retrieves the permalink for the feed type. |
wp-includes/link-template.php: get_permalink() |
Retrieves the full permalink for the current post or post ID. |
wp-includes/link-template.php: get_attachment_link() |
Retrieves the permalink for an attachment. |
wp-includes/ms-deprecated.php: wpmu_admin_redirect_add_updated_param() |
Adds an ‘updated=true’ argument to a URL. |
wp-includes/class-wp-http.php: WP_Http::processHeaders() |
Transforms header string into an array. |
wp-includes/class-wp-http.php: WP_Http::block_request() |
Determines whether an HTTP API request to the given URL should be blocked. |
wp-includes/class-wp-http.php: WP_Http::is_ip_address() |
Determines if a specified string represents an IP address or not. |
wp-includes/user.php: check_password_reset_key() |
Retrieves a user row based on password reset key and login. |
wp-includes/user.php: sanitize_user_field() |
Sanitizes user field based on context. |
wp-includes/class-wpdb.php: wpdb::prepare() |
Prepares a SQL query for safe execution. |
wp-includes/class-wpdb.php: wpdb::has_cap() |
Determines whether the database or WPDB supports a particular feature. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::_multisite_getUsersBlogs() |
Private function for retrieving a users blogs for multisite setups. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::attach_uploads() |
Attaches an upload to a post. |
wp-includes/class-wp-xmlrpc-server.php: wp_xmlrpc_server::pingback_ping() |
Retrieves a pingback and registers it. |
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::_publish_changeset_values() |
Publishes the values of a changeset. |
wp-includes/post-template.php: get_the_content() |
Retrieves the post content. |
wp-includes/class-wp-http-proxy.php: WP_HTTP_Proxy::send_through_proxy() |
Determines whether the request should be sent through a proxy. |
wp-includes/class-wp-rewrite.php: WP_Rewrite::get_date_permastruct() |
Retrieves date permalink structure, with year, month, and day. |
wp-includes/class-wp-rewrite.php: WP_Rewrite::generate_rewrite_rules() |
Generates rewrite rules from a permalink structure. |
wp-includes/class-wp-rewrite.php: WP_Rewrite::mod_rewrite_rules() |
Retrieves mod_rewrite-formatted rewrite rules to write to .htaccess. |
wp-includes/class-wp-rewrite.php: WP_Rewrite::add_rule() |
Adds a rewrite rule that transforms a URL structure to a set of query vars. |
wp-includes/canonical.php: redirect_canonical() |
Redirects incoming links to the proper URL based on the site url. |
wp-includes/post.php: is_local_attachment() |
Determines whether an attachment URI is local and really an attachment. |
wp-includes/post.php: wp_get_attachment_url() |
Retrieves the URL for an attachment. |
wp-includes/post.php: wp_match_mime_types() |
Checks a MIME-Type against a list. |
wp-includes/post.php: wp_post_mime_type_where() |
Converts MIME types into SQL. |
wp-includes/post.php: sanitize_post_field() |
Sanitizes a post field based on context. |
wp-includes/kses.php: safecss_filter_attr() |
Filters an inline style attribute and removes disallowed rules. |
wp-includes/class-wp.php: WP::parse_request() |
Parses the request to find the correct WordPress query. |
wp-includes/class-wp.php: WP::send_headers() |
Sends additional HTTP headers for caching, content type, etc. |
wp-includes/class-wp.php: WP::handle_404() |
Set the Headers for 404, if nothing is found for requested URL. |
wp-includes/class-wp-site-query.php: WP_Site_Query::get_search_sql() |
Used internally to generate an SQL string for searching across multiple columns. |
wp-includes/ms-functions.php: maybe_add_existing_user_to_blog() |
Adds a new user to a blog by visiting /newbloguser/{key}/. |
wp-includes/ms-functions.php: check_upload_mimes() |
Checks an array of MIME types against a list of allowed types. |
wp-includes/formatting.php: wp_encode_emoji() |
Converts emoji characters to their equivalent HTML entity. |
wp-includes/formatting.php: wp_staticize_emoji() |
Converts emoji to a static img element. |
wp-includes/formatting.php: wp_staticize_emoji_for_email() |
Converts emoji in emails into static images. |
wp-includes/formatting.php: _sanitize_text_fields() |
Internal helper function to sanitize a string from user input or from the database. |
wp-includes/formatting.php: wp_pre_kses_less_than_callback() |
Callback function used by preg_replace. |
wp-includes/formatting.php: esc_url() |
Checks and cleans a URL. |
wp-includes/formatting.php: convert_chars() |
Converts lone & characters into |
wp-includes/formatting.php: convert_invalid_entities() |
Converts invalid Unicode references range to valid range. |
wp-includes/formatting.php: wp_specialchars_decode() |
Converts a number of HTML entities into their special characters. |
wp-includes/formatting.php: sanitize_file_name() |
Sanitizes a filename, replacing whitespace with dashes. |
wp-includes/formatting.php: wptexturize() |
Replaces common plain text characters with formatted entities. |
wp-includes/formatting.php: wptexturize_primes() |
Implements a logic tree to determine whether or not “7′.” represents seven feet, then converts the special char into either a prime char or a closing quote char. |
wp-includes/formatting.php: wpautop() |
Replaces double line breaks with paragraph elements. |
wp-includes/formatting.php: wp_replace_in_html_tags() |
Replaces characters or phrases within HTML elements only. |
wp-includes/class-wp-editor.php: _WP_Editors::parse_settings() |
Parse default arguments for the editor instance. |
wp-includes/class-wp-editor.php: _WP_Editors::editor_settings() | |
wp-includes/class-wp-editor.php: _WP_Editors::wp_mce_translation() |
Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n(), or as JS snippet that should run after tinymce.js is loaded. |
wp-includes/load.php: wp_convert_hr_to_bytes() |
Converts a shorthand byte value to an integer byte value. |
wp-includes/load.php: wp_fix_server_vars() |
Fix |
wp-includes/feed.php: prep_atom_text_construct() |
Determines the type of a string of data with the data formatted. |
wp-includes/class-wp-comment-query.php: WP_Comment_Query::get_comment_ids() |
Used internally to get a list of comment IDs matching the query vars. |
wp-includes/revision.php: wp_save_post_revision() |
Creates a revision for the current version of a post. |
wp-includes/revision.php: wp_is_post_autosave() |
Determines if the specified post is an autosave. |
wp-includes/comment-template.php: comment_form() |
Outputs a complete commenting form for use within a template. |
wp-includes/comment-template.php: get_comments_number_text() |
Displays the language string for the number of comments the current post has. |
wp-includes/class-wp-oembed.php: WP_oEmbed::_strip_newlines() |
Strips any new lines from the HTML. |
wp-includes/shortcodes.php: shortcode_parse_atts() |
Retrieves all attributes from the shortcodes tag. |
wp-includes/shortcodes.php: strip_shortcodes() |
Removes all shortcode tags from the given content. |
wp-includes/shortcodes.php: has_shortcode() |
Determines whether the passed content contains the specified shortcode. |
wp-includes/shortcodes.php: do_shortcode() |
Searches content for shortcodes and filter shortcodes through their hooks. |
wp-includes/shortcodes.php: do_shortcodes_in_html_tags() |
Searches only inside HTML elements for shortcodes and process them. |
wp-includes/functions.php: _device_can_upload() |
Tests if the current device has the capability to upload files. |
wp-includes/functions.php: wp_guess_url() |
Guesses the URL for the site. |
wp-includes/functions.php: apache_mod_loaded() |
Determines whether the specified module exist in the Apache config. |
wp-includes/functions.php: validate_file() |
Validates a file name and path against an allowed set of rules. |
wp-includes/functions.php: _mce_set_direction() |
Sets the localized direction for MCE plugin. |
wp-includes/functions.php: wp_unique_filename() |
Gets a filename that is sanitized and unique for the given directory. |
wp-includes/functions.php: wp_mkdir_p() |
Recursive directory creation based on full path. |
wp-includes/functions.php: add_query_arg() |
Retrieves a modified URL query string. |
wp-includes/functions.php: is_serialized() |
Checks value to find if it was serialized. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::js_1() |
Display JavaScript based on Step 1 and 3. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::step_1() |
Display first step of custom header image page. |
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-automatic-upgrader-skin.php: Automatic_Upgrader_Skin::feedback() |
Stores a message about the upgrade. |
wp-admin/includes/media.php: wp_media_attach_action() |
Encapsulates the logic for Attach/Detach actions. |
wp-admin/includes/media.php: media_upload_form() |
Outputs the legacy media upload form. |
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: media_upload_form_handler() |
Handles form submissions for the legacy media uploader. |
wp-admin/includes/class-bulk-upgrader-skin.php: Bulk_Upgrader_Skin::feedback() | |
wp-admin/includes/class-wp-upgrader-skin.php: WP_Upgrader_Skin::feedback() | |
wp-admin/includes/class-core-upgrader.php: Core_Upgrader::upgrade() |
Upgrade ClassicPress core. |
wp-admin/includes/class-core-upgrader.php: Core_Upgrader::_auto_update_enabled_for_versions() |
Determines if an automatic update should be applied for a given set of versions and auto-update constants. |
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_query_themes() |
Ajax handler for getting themes from themes_api(). |
wp-admin/includes/ajax-actions.php: wp_ajax_parse_embed() |
Apply [embed] Ajax handlers to a string. |
wp-admin/includes/ajax-actions.php: wp_ajax_widgets_order() |
Ajax handler for saving the widgets order. |
wp-admin/includes/ajax-actions.php: wp_ajax_ajax_tag_search() |
Ajax handler for tag search. |
wp-admin/includes/upgrade.php: make_site_theme_from_default() |
Creates a site theme from the default theme. |
wp-admin/includes/upgrade.php: dbDelta() |
Modifies the database based on specified SQL statements. |
wp-admin/includes/upgrade.php: make_site_theme_from_oldschool() |
Creates a site theme from an existing theme. |
wp-admin/includes/class-wp-automatic-updater.php: WP_Automatic_Updater::run() |
Kicks off the background update process, looping through all pending updates. |
wp-admin/includes/class-wp-automatic-updater.php: WP_Automatic_Updater::after_core_update() |
If we tried to perform a core update, check if we should send an email, and if we need to avoid processing future updates. |
wp-admin/includes/user.php: edit_user() |
Edit user settings based on contents of $_POST |
wp-admin/includes/plugin.php: get_admin_page_parent() |
Gets the parent file of the current admin page. |
wp-admin/includes/plugin.php: get_plugin_data() |
Parses the plugin contents to retrieve plugin’s metadata. |
wp-admin/includes/class-wp-ms-sites-list-table.php: WP_MS_Sites_List_Table::prepare_items() |
Prepares the list of sites for display. |
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: _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/class-wp-ajax-upgrader-skin.php: WP_Ajax_Upgrader_Skin::error() |
Stores an error message about the upgrade. |
wp-admin/includes/post.php: get_sample_permalink_html() |
Returns the HTML of the sample permalink slug editor. |
wp-admin/includes/post.php: _admin_notice_post_locked() |
Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. |
wp-admin/includes/post.php: _fix_attachment_links() |
Replaces hrefs of attachment anchors with up-to-date permalinks. |
wp-admin/includes/class-wp-users-list-table.php: WP_Users_List_Table::single_row() |
Generate HTML for a single row on the users.php admin panel. |
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |