Reference › Cost rankings
WordPress 7.1.0PHP 8.44,809 functions ranked
What is expensive in WordPress
Every function in core, ranked by what it costs to call. The unit is the Zend VM instruction, counted from the compiled opcodes, so a number here is the same on any machine that runs the same PHP version. Nothing is timed.
An instruction is not a fixed amount of time, and one database call outweighs a thousand assignments. Read the count as how much work a function does itself, and the tags beside each name for what it reaches. The method is documented in full.
Heaviest single call
Ranked by the most Zend VM instructions one call can execute. This is how much work the function does itself, before it delegates: not a timing, and not a verdict on speed, since a single database call outweighs a thousand assignments.
- 12,372instructions
- 21,057instructions
- 3create_initial_post_types()
Creates the initial post types when 'init' action is fired.
queryoptionhook964instructions - 4wp_enqueue_media()
Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs.
queryoptionhook7 callers682instructions - 5541instructions
- 6531instructions
- 7wp_nav_menu_item_post_type_meta_box()
Displays a meta box for a post type menu item.
sqlqueryoptionhook512instructions - 8comment_form()
Outputs a complete commenting form for use within a template.
queryoptionhookloops2 callers492instructions
Most hooks fired in one call
Every hook is an opening for third-party code, and nothing in core bounds what that code costs. These are the functions where a slow site is most often not core's fault.
- 1comment_form()
Outputs a complete commenting form for use within a template.
queryoptionhookloops2 callers18hooks - 218hooks
- 316hooks
- 413hooks
- 512hooks
- 612hooks
- 710hooks
- 810hooks
Functions that reach the network
Calling one of these during a page render puts a remote host in your critical path. Ranked by how many places in core call them, because that is how often the cost is paid on your behalf.
- 1wp_remote_get()
Performs an HTTP request using the GET method and returns its response.
http20 callers20core callers - 2wp_remote_post()
Performs an HTTP request using the POST method and returns its response.
http9 callers9core callers - 3themes_api()
Retrieves theme installer pages from the WordPress.org Themes API.
httpqueryoptionhookloops8 callers8core callers - 4plugins_api()
Retrieves plugin installer pages from the WordPress.org Plugins API.
httpqueryoptionhook8 callers8core callers - 5wp_safe_remote_get()
Retrieves the raw response from a safe HTTP request using the GET method.
http8 callers8core callers - 66core callers
- 7wp_version_check()
Checks WordPress version against the newest version.
httpqueryoptionhookloops5 callers5core callers - 8wp_update_plugins()
Checks for available updates to plugins based on the latest versions hosted on WordPress.org.
httpqueryoptionhook5 callers5core callers
Most distinct cost outcomes
Distinct ways one call can run, each with its own price, recovered from the control-flow graph. A high count means cost depends heavily on arguments and site state, so any single benchmark of these tells you very little.
- 14,000outcomes
- 2wp_hoist_late_printed_styles()
Adds the hooks needed for CSS output to be delayed until after the content of the page has been established.
sqlqueryoptionhookloops3,006outcomes - 3twentyfifteen_entry_meta()
Prints HTML with meta information for the categories, tags.
queryoptionhook2,740outcomes - 42,016outcomes
- 51,912outcomes
- 6download_url()
Downloads a URL to a local temporary file using the WordPress HTTP API.
httpfilesystemqueryoption3 callers1,716outcomes - 7customize_themes_print_templates()
Prints JS templates for the theme-browsing UI in the Customizer.
queryoptionhook1,568outcomes - 81,536outcomes
Most called by core
Cost paid far more often than your own code suggests, because core calls these throughout a request whether or not you do. A change in one of these is felt everywhere.
- 1get_permalink()
Retrieves the full permalink for the current post or post ID.
queryoptionhook50 callers50core callers - 250core callers
- 350core callers
- 450core callers
- 550core callers
- 650core callers
- 750core callers
- 8wp_die()
Kills WordPress execution and displays HTML page with an error message.
queryoptionhook50 callers50core callers
Free to call
No calls out, no I/O, constant work. Caching the result of one of these costs more than calling it again.
- 11instructions
- 21instructions
- 31instructions
- 4twentytwenty_get_customizer_color_vars()
Returns an array of variables for the customizer preview.
2 callers1instructions - 51instructions
- 61instructions
- 71instructions
- 8__return_empty_array()
Returns an empty array.
1instructions