Remove Font-Awesome MaxCDN Link & Load Locally

You must find the name of the enqueued stylesheet in your theme and use it to dequeue a style – wp_dequeue_style. URL is unnecessary. Example: function remove_unwanted_css() { wp_dequeue_style( ‘font-awesome’ ); } add_action( ‘wp_print_styles’, ‘remove_unwanted_css’, 100 ); Or another solution wp_deregister_style/: add_action( ‘wp_enqueue_scripts’, ‘remove_default_stylesheet’, 20 ); function remove_default_stylesheet() { wp_dequeue_style( ‘font-awesome’ ); wp_deregister_style( ‘font-awesome’ ); … Read more

restore_current_blog required after switch_to_blog, if I use that in a function?

switch_to_blog changes values of global variables (as you can see here: https://core.trac.wordpress.org/browser/tags/5.0.3/src/wp-includes/ms-blogs.php#L801). It doesn’t matter if you call it in function or not – these variables will get changed. So yes – you always have to call restore_current_blog when you’ve done all you wanted with the switched blog. Otherwise these variables will stay changed (so … Read more

Running CRON on Server with WP Function

We need to include wp-load.php in order to bootstrap WordPress in our custom PHP code. So, the modified code would look something like this… include ‘/path/to/wp-load.php’; //RemoteCoins() and LoadRemoteCoins() that include wp functions like wp_remote_get() function runthe_func() { //some code here } runthe_func(); Now, if we run this file on server cron, it wouldn’t throw … Read more

What does the author_nicename parameter do in get_author_posts_url()?

Say that get_author_posts_url(1) return the following URL https://example.com/author/admin/ Passing the $author_nicename will change this. So get_author_posts_url(1, ‘foo’) will result in https://example.com/author/foo/ You can also check this in the source code of get_author_posts_url(). So what does passing the second argument do? It changes the resulting URL. If you don’t provide further mechanisms, this will probably result … Read more