This function doesn’t take any params, so there is no nice way of doing it.
But of course you can do this PHP way using output buffering 😉
ob_start();
wp_head();
$var = ob_get_clean();
Related Posts:
- How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
- Change dns-prefetch to preconnect with correct protocol
- Add footer.php to WordPress child theme
- Header has extra HTML block at top before my code
- How to safely remove the footer (twentytwenty)
- action hook wp_head higher priority as all other plugins/hooks
- Where would I place `wp_footer();`?
- Remove meta description on certain pages
- wp_head function not outputting
- Copyright info change – Corporate Plus Theme PHP [closed]
- Sidebar not appearing in footer, but it appears everywhere else!
- My website is not showing Footer section
- How do I properly code my footer? See example
- How to style injected code in header section?
- How do you remove header sitewide from mobile only?
- switch_to_blog() + do_action(‘generate_footer’) not working in multisite
- How to remove get_header From all single pages in wordpress with functions.php without plugin?
- Add a top bar to a wordpress theme without editing the header.php file?
- Using Javascript On Page – Header and Footer Now Missing
- Add my footer menu to the header
- Add function to head “no product found”
- Switch position of elements in the footer [closed]
- Not able to add new item in wordpress home page
- Load admin bar without wp_head or wp_footer [duplicate]
- Links in footer section
- How to implement conditional PHP in Footer
- How can a ‘scripts’ directory be hooked into wp_head();?
- Particular meta tag – viewport – insertion when dealing with plugin
- Why is my footer missing [closed]
- Require Credits Footer
- footer doesn’t display
- How to modify default tags in wp_head()
- What is the best php version to use with WordPress?
- How to call a function only once (global variable scope)
- Multiple is_page() in page.php
- Get author full name
- Where should I install a PHP library into WordPress so that code in a webpage can activate it?
- How to make WordPress plugin check for database changes and then do something?
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- Limit the_excerpt with max of x characters
- wp_get_attachment_url filter won’t accept two arguments
- nowplaying.include.php Will Not Display Results
- Am I not understanding plugins?
- Passing the page ID to a login php script
- wrong php date()?
- Rename “Portfolio” slug?
- Render ninja form inside markup
- Remove a filter added by a plugin
- How to show 50×50 image thumbnail in Related Post
- How to select the contents in the text view textrea in wp_editor?
- Namespace spl_autoload problem in WordPress admin
- How to save checkbox values for logged in users?
- How to store data from multiple forms using ajax and php
- How to control WordPress image metadata (using Imagick)?
- Ajax date_query not working past the first iteration
- get_terms pagination
- Output custom field value to post string
- How to sent a email outside WordPress?
- Update post title from external file?
- WordPress plug-in for dynamic download link?
- Override user-edit.php to design own profile page
- How can I add a new row in a separate database when someone registers via WordPress?
- Add 23 hours 59 minutes and 59 seconds to meta key before saving?
- proc_open() fires twice
- How can I get all values from my array in a loop in php? [closed]
- Creating custom page template from existing PHP site
- wordpress site – using custom database and PHP
- Woocommerce custom Plugin in wordpress [closed]
- Implementing custom tag/tax pages
- Change homepage content if user is logged in – BuddyPress
- Replace Post-Title with variable
- WordPress loop is not working
- Display movies that apear this day next
- How to edit background color of only one sidebar?
- Edit and delete permissions pages and posts
- Removing links from Grouped products
- Add custom field on admin dashboard comments / reviews
- Display one random image from Media Library
- How do I programmatically add ‘reviews_allowed’ to WooCommerce product?
- Problem with my Login Plugin
- Suddenly got alert when trying to login to admin panel of wordpress
- Taxonomy Child Term, Counter is staying on 0
- LinkedIn Share Post Button
- wordpress more than one ajax request at the same time issue
- How to display recently modified posts on recent post widget in wordpress
- Explode Content within specific HTML element
- PHP Shortcode – 500 error
- Non-array argument in array_merge()-function [closed]
- Add specific content after specific text in every post
- retrieve wordpress post-meta using php not wordpress functions
- Too few arguments for printf() [closed]
- custom data in url
- Dynamically append custom post type to end of url
- Automatically load WordPress page on server every XX hours
- Parse error: syntax error, unexpected ‘}’ in C:\wamp64\www\Proiect\aplicatie\user_check.php on line 18 [closed]
- Pagination in category.php not functioning
- Wrapping the_content() in Schema articleBody tag? [closed]
- Open WordPress Page from selected option dropdown
- Add multiple HTML attributes to an Elementor button
- How to sort custom sortable column by custom table value