Based on the image, my guess is that your setting for the email subject is empty, and the plugin is not expecting that–its behavior is to set the subject as “setting post title”, and doesn’t know to account for a potentially empty string.
I can mark this as something to fix in a future release. If it’s something you want fixed immediately, I would recommend using the dynamic scriptlesssocialsharing_email_query_args
filter (you will want to modify the subject
in the array of args).
Hi Robin,
I’m a bit of a layman. Where do I add this code exactly?
change this:
‘subject’ => $this->email_subject() . ‘ ‘ . $this->attributes[‘title’],
to this?:
‘subject’ => $this->email_subject() . ‘ ‘ . $this->[‘title’],
Thank you
No, you will need to create an entire function to use the filter to change the subject. The new code can be added to your theme’s functions.php file, or wherever you add code snippets–just make sure you have things backed up before you start tinkering.
This code is not tested, but should do what you want–you’ll want to test and verify:
add_filter( 'scriptlesssocialsharing_email_query_args', 'prefix_scriptless_modify_subject', 10, 4 );
/**
* If no email subject is set in the plugin settings, this
* returns just the post title as the email subject.
*
* @param array $args
* @param string $button_name
* @param array $attributes
* @param array $setting
* @return array
*/
function prefix_scriptless_modify_subject( $args, $button_name, $attributes, $setting ) {
if ( ! empty( $setting['email_subject'] ) ) {
return $args;
}
$args['subject'] = $attributes['title'];
return $args;
}
yes, I can confirm this works! thank you Robin!