{"id":56681,"date":"2025-12-04T15:50:49","date_gmt":"2025-12-04T15:50:49","guid":{"rendered":"https:\/\/www.roger-pearse.com\/weblog\/?p=56681"},"modified":"2025-12-04T15:50:49","modified_gmt":"2025-12-04T15:50:49","slug":"from-my-diary-556","status":"publish","type":"post","link":"https:\/\/roger-pearse.com\/weblog\/2025\/12\/04\/from-my-diary-556\/","title":{"rendered":"From my diary"},"content":{"rendered":"<p align=\"justify\">The last day was mostly lost in trying to sort out two problems with the blog software.\u00a0 First, when posting a link to a post to Twitter, no image appeared.\u00a0 Secondly, if I added a comment to a post, I &#8211; the author &#8211; got no email notification.<\/p>\n<p align=\"justify\">Yesterday I got fed up and delved into the WordPress code.\u00a0 It&#8217;s PHP, after all, which is a language that I have used before.\u00a0 A bit of debugging using PHP error_log() calls revealed that&#8230; if an author comments on his own post, by default WordPress doesn&#8217;t notify him.\u00a0 Which is why I never saw any notifications.\u00a0 Nor does WordPress make this a setting in the dashboard.\u00a0 The change makes debugging a new installation that little bit harder.\u00a0 The answer is to comment from another browser &#8211; one you are not logged into.\u00a0 But of course nobody would\u00a0 know that by default.<\/p>\n<p align=\"justify\">Anyway the code makes clear what the answer is: to write a little single-file plugin that overrides a WordPress function and returns &#8220;true&#8221;.\u00a0 This I have done, and it works just fine.\u00a0 Here it is:<\/p>\n<ul>\n<li><a href=\"https:\/\/roger-pearse.com\/weblog\/wp-content\/uploads\/2025\/12\/rp-enable-author-comments-notify-emails.zip\">rp-enable-author-comments-notify-emails<\/a> (.zip file)<\/li>\n<\/ul>\n<p align=\"justify\">If you activate the plugin, it overrides the bit of code (in wp-includes\/pluggable.php) that checks whether author comments should trigger a notification email.\u00a0 If you deactivate it, it removes that.<\/p>\n<p align=\"justify\">I&#8217;d always wondered about how to write my own plugin.\u00a0 Fortunately it&#8217;s simple.<\/p>\n<p align=\"justify\">Now to see whether the Twitter stuff works or not.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The last day was mostly lost in trying to sort out two problems with the blog software.\u00a0 First, when posting a link to a post to Twitter, no image appeared.\u00a0<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_awef_post_faq_schema":[],"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[19],"tags":[],"class_list":["post-56681","post","type-post","status-publish","format-standard","hentry","category-from-my-diary-announcements"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/roger-pearse.com\/weblog\/wp-json\/wp\/v2\/posts\/56681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/roger-pearse.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/roger-pearse.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/roger-pearse.com\/weblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/roger-pearse.com\/weblog\/wp-json\/wp\/v2\/comments?post=56681"}],"version-history":[{"count":0,"href":"https:\/\/roger-pearse.com\/weblog\/wp-json\/wp\/v2\/posts\/56681\/revisions"}],"wp:attachment":[{"href":"https:\/\/roger-pearse.com\/weblog\/wp-json\/wp\/v2\/media?parent=56681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/roger-pearse.com\/weblog\/wp-json\/wp\/v2\/categories?post=56681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/roger-pearse.com\/weblog\/wp-json\/wp\/v2\/tags?post=56681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}