How to set the WordPress logo programmatically with PHP
I am working on a WordPress theme. We implemented "One Click Demo Import" for the theme users to quickly populate their new blank theme with some dummy data.
My question is, how can I set the logo of a WordPress site with PHP? This needs to be done inside an action. I call add_action( 'pt-ocdi/after_import', 'kinsley_ocdi_after_import_setup' );
and in the kinsley_ocdi_after_import_setup
I need to run this processing code.
This seems like it should not be hard to do, but I cannot find a "set_logo" function. Is this possible using just WordPress core? None of the *_custom_logo()
functions allow data to be altered.
What I am looking for inside the action function:
// set logo
if (!has_custom_logo()) {
// set logo of site to an image located at http://www.example.com/myimage.png
}