I code custom plugins for Wordpress. I use Microsoft Visual Studio Code to do the coding and FileZilla to transfer the files.
With almost every php file that I code, I'm not sure if it's something that's happening when I download my plugin and then upload it to a new site, or if it's when I install it on a new site from a zip file, but when I check the code I find that the entire code has ended up with double line breaks!
i.e.,
function gdvcaddons_admin() {
add_menu_page("GD Addons Settings", "GD Addons Settings", "administrator", "gdvcaddons-settings", "gdvcaddons_settings_page");
}
add_action('admin_menu', 'gdvcaddons_admin');
// DEFINE OPTIONS TO BE SAVED //
function gdvcaddons_settings() {
register_setting( 'gdvcaddons-settings-group', 'recaptcha_site_key' );
register_setting( 'gdvcaddons-settings-group', 'recaptcha_private_key' );
}
add_action( 'admin_init', 'gdvcaddons_settings' );
// DECLARE FILE CONTAINING OPTIONS FORM //
function gdvcaddons_settings_page(){
include('inc/gdvcaddons-settings-form.php');
}
Becomes:
function gdvcaddons_admin() {
add_menu_page("GD Addons Settings", "GD Addons Settings", "administrator", "gdvcaddons-settings", "gdvcaddons_settings_page");
}
add_action('admin_menu', 'gdvcaddons_admin');
// DEFINE OPTIONS TO BE SAVED //
function gdvcaddons_settings() {
register_setting( 'gdvcaddons-settings-group', 'recaptcha_site_key' );
register_setting( 'gdvcaddons-settings-group', 'recaptcha_private_key' );
}
add_action( 'admin_init', 'gdvcaddons_settings' );
// DECLARE FILE CONTAINING OPTIONS FORM //
function gdvcaddons_settings_page(){
include('inc/gdvcaddons-settings-form.php');
}
It is quite a problem because it keeps causing Yoast SEO's sitemaps to break and I keep having to open all my php files via FTP and do regex search/replace "\s\n" with "\n".
Does anyone have any idea what might be causing this issue and how I can prevent it from reoccurring?
Try to change
transfer type
For single FTPs
Global Settings.