tferral
Forum Replies Created
-
Joy,
I did activate another theme = twenty nineteen – and the blank lines are gone.
I also activated the original Classic theme and the lines are gone.
So – it is my problem, some change I’ve made to the Classic theme.
There are some formatting errors in the Classic theme and some things that need to be tidied up. That’s why I’m changing it to create a new theme.
I’m still a tad confused as to why the lines appear on Admin pages. I didn’t think that the Admin pages used any of the theme files but I appear to be wrong.
I’ll run a file comparison on the original theme files and the new theme I’m creating from them and see what I can find.
I’ll come back and update this when I find (or don’t find) the cause of the lines.
One interesting thing that I have noticed as I looked at it more closely, the first blank line contains blanks but the other eight lines are empty (I assume they are just new line characters).
UPDATE -only two of the nine lines show in the code block in my original post.
The blank lines have line numbers, in the source display, just line all other lines in the display.
I missed the “Reply and Close” checkbox when I submitted my reply, above.
This time I’ll mark it as resolved.
Thanks for the reply.
I rewrote me code and added a test to be sure that the post_type was “post” and it is working correctly.
Here’s my code:
// This function will set comment_status to closed for new posts with post_type equal to 'post' // If the post is not new, if it is an update, nothing is done. function wp_insert_post_data_filter_handler( $data , $postarr ) { if ($postarr['post_type'] == 'post') { // Q. Is this a "post" type post? if ($postarr['ID'] == 0) { // Yes. Q. Is this a new post (ID will be zero for a new post) $data['comment_status'] = 'closed'; // Yes. Set comment_status to "closed" } } return $data; // you must return the $data array, regardless of whether you've made any changes // or processing will not complete correctly. } // Hang the function on the "wp_insert_post_data" hook add_filter( 'wp_insert_post_data', 'wp_insert_post_data_filter_handler', '99', 2 );I’ve seen many people ask how to turn off comments by default on new posts – this code, placed in the theme’s functions.php file will do the job.