Code Executing Too Late?

Per comments, declare it global before using in both (or all) places: global $sitetype; if ( $_SERVER[“HTTP_HOST”] === “domain1.com” ) { $sitetype = one; } //etc and global $sitetype; if ( $sitetype == all ){ echo “site type 1”; } //etc

How to update mu-plugin

First, please check this out: https://codex.wordpress.org/Must_Use_Plugins In most cases mu plugins consist of a singular php file in that directory. In that case you could just replace the file. In any case, there is neither a process for installation nor uninstallation, you simply drop files in that dir or delete them from it. It’s as … Read more

Notice: Uninitialized string offset: 0 in social sharing mu-plugin

Your custom get_the_post_thumbnail_src() function returns a string and not an array, hence in the following code, $sb_thumb is not an array: $sb_thumb = get_the_post_thumbnail_src(get_the_post_thumbnail()); So the PHP notice in question occurred because you used $sb_thumb[0] in the following code, which appears twice in your wpvkp_social_buttons() function: $pinterestURL = ‘https://pinterest.com/pin/create/button/?url=”.$sb_url.”&media=”.$sb_thumb[0].”&description=’.$sb_title; And to get rid of the … Read more

Certain functions are undefined when called form mu-plugins

Thanks to diggy from StackOverflow I’ve foudn that in the WordPress cycle, the file vars.php (containing my needed functions) is included after muplugins_loaded executes. Including wp_is_mobile() and current_user_can() in wrapper functions fixed my problem. CORRECT function my_epic_function() { if(current_user_can( ‘edit_posts’ )) { if(!wp_is_mobile()) { //code to be executed } } } add_action(‘init’, ‘my_epic_function’); INCORRECT function … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)