Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Custom logo manage by customizer and theme options

Have a look into set_theme_mod():

Creates or updates a modification setting for the current theme

and get_theme_mod():

Retrieves a modification setting for the current theme

With this you should be able to get the logo:

$custom_logo_id = get_theme_mod( 'custom_logo' );
$logo = wp_get_attachment_image( $custom_logo_id, 'full' );

This would set the attachment 12 as the logo

$attachment_id = 12;
set_theme_mod( 'custom_logo', $attachment_id );

Hope, this helps 🙂

Related Posts:

  1. How do I handle the “WP_Customize_Cropped_Image_Control” callback?
  2. How do I use add_control to offer a list of all pages in the customiser?
  3. Can i use the same sanitize function on multiple theme mod textboxes?
  4. Insert content between sections in WP customizer
  5. Function has_custom_logo when used in Customizer
  6. Defining path of content folder in WP-config solves the issue of missing header, footer, theme options. Is this a good approach? Expert Advice needed
  7. In 2016 Theme where is the Posts page thumbnail image stored?
  8. Exiting Customizer alert
  9. Why Settings API Options Override Customizer Settings?
  10. Manipulating customizer panels and fields?
  11. Issues Saving Long String Option
  12. get_option() vs get_theme_mod(): Why is one slower?
  13. Where is Customizer related data stored is the database?
  14. How do I implement selective refresh with a customizer setting?
  15. How to create a theme customizer ‘sub’ panel?
  16. Adding a description to theme customizer controls
  17. Use default value of wp_customizer in theme_mod output?
  18. Repeater field in Customizer
  19. Adjust the Device Preview sizes used in the WP 4.5 Customizer
  20. Is it possible ( or advisable) to allow open access to the new theme customizer for potential clients?
  21. Add a dropdown to theme customizer
  22. WP Customizer – Prevent live preview
  23. How to upload multiple images with WP_Customize_Media_Control
  24. Different customizer previewUrls per section
  25. Is there any way to add placeholder for WordPress Customizer text input fields
  26. How WP_Customize_Background_Image_Control is supposed to work?
  27. Custom editable content for front page from Theme Customizer
  28. How to print the value of a custom control in the Customizer?
  29. Add/remove controls dynamically based on other settings in Customizer
  30. Customizer JS API dynamically add sections and controls
  31. Get all registered wp theme customizer sections?
  32. Add custom background to div in home page
  33. Theme customizer – possible to disable Live Preview?
  34. get_theme_mod doesn’t return the theme customizer preview’s new values in after_setup_theme hook
  35. How to mix partial and full page refresh in the same section of the customizer?
  36. Conditional Logic to Check for Site Icon
  37. Theme Customization API options on install
  38. How do I check if user input in a field in the customizer is a number?
  39. How to access the nav_menus panel with the customizer api?
  40. Add a “loading” notice when Customizer is making changes
  41. Make Theme Options Native to Theme Customizer
  42. How do I conditionally enqueue stylesheets or scripts in theme customizer settings?
  43. WordPress Customizer Typography: How to load just the unique Google Fonts?
  44. Theme option : having the ability to select among several predefined headers
  45. Internalize get_theme_mod CSS Into Stylesheet?
  46. Customiser `active_callback` not working on control with `postMessage` transport method
  47. Is it possible to conditionally displaying and hiding of customizer controls for each device preview?
  48. How to get control choices from $setting object passed to sanitize_callback
  49. Can I change a control’s transport in Customizer depending on the previewed page?
  50. Passing data from customize-controls.js to the customize-preview.js
  51. Add or remove HTML class with selective refresh?
  52. Get attachment id from WP Customizer
  53. How to output WP_Customize_Cropped_Image_Control setting?
  54. Why does get_theme_mod return blank (or default value) but get_option returns saved value?
  55. How to hook on customizer section expanded/active/opened event?
  56. Get current post ID of customizer preview window
  57. Deactivate sections/panels when the Customizer finishes loading
  58. How to remove menus section from WordPress theme customizer
  59. Add button to Customizer
  60. Visible Edit Shortcut for WordPress menu that uses nav walker
  61. How to add theme customizer control to specific page?
  62. Customizer active callback live toggle controls
  63. Why is remove_setting and remove_control not working?
  64. Section Name for Menu in Theme Customizer
  65. Is it still possible to nest panels within panels within the customizer?
  66. Get_theme_mod not retrieving value
  67. Need to run a plugin on Customize.php
  68. Customizer preview doesn’t update get_option() value properly
  69. What is the difference between sanitize_text_field() and wp_filter_nohtml_kses()?
  70. Customizer Issue, Default Settings not working
  71. How to move Menus customizer section directly under Site Identity?
  72. WP customizer + gulp + browsersync = refused to display in iframe?
  73. Set Default Page On Customizer Live Preview
  74. Rename and rearrange customizer section
  75. Make Customizer Load Specific Page
  76. Theme Customizer Custom Background / Header Image
  77. get_theme_mod not working
  78. Customizer not saving image settings
  79. How to hide few theme customization options – TwentySeventeen theme
  80. Panel description in Customizer does not show up
  81. Removing http:// from esc url() for wordpress customizer code
  82. Theme Customizer – My panel disappears
  83. Send data from Customizer Settings to Customizer Preview with settingless control
  84. Author functions don’t work in customizer’s selective refresh
  85. How to remove mixed content warnings in WP Customizer
  86. How to extend Customizer payload sent when ‘Save & Publish’ is triggered
  87. Does the customizer support multiple templates?
  88. Using Theme Customizer Built-In Sections
  89. How to use rgba color from theme customizer color picker
  90. Theme Customizer changes are dissappearing when change page
  91. How can a default site icon be set in customizer?
  92. How to hook CSS file according to theme selection in the customizer section
  93. New customizer setting not showing value
  94. Customizer Selective Refresh doesn’t refresh properly with saved value
  95. WP Customizer JS Template not saving color field
  96. WordPress Customizer sanitize_callback: How to Reset to Default on Fail
  97. Removing pre existing menu item
  98. Change “Display Site Title and Tagline” checkbox text in theme customizer
  99. How Can I Create a List of Values to Be Iterated Through via WordPress Customization API?
  100. Customizer, change preview url when a control changes
Categories theme-customizer Tags logo, theme-customizer, theme-options
Custom Post Type Trouble
Automatically adding blog images to a portfolio/gallery

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress