M
M
Maxim2021-12-18 21:27:41
WordPress
Maxim, 2021-12-18 21:27:41

How to remove "Notice: Only variables should be assigned by reference in" error in Wordpress?

Good day to all!
After updating Wordpress on the site, errors appeared in the template files:

Notice: Only variables should be passed by reference in /var/site-ru/wp-content/themes/theme1692/functions.php on line 72
Notice: Only variables should be assigned by reference in /var/site-ru/wp- content/themes/theme1692/functions.php on line 72


67) // Removes Trackbacks from the comment cout
68)	add_filter('get_comments_number', 'comment_count', 0);
69)	function comment_count( $count ) {
70)		if ( ! is_admin() ) {
71)			global $id;
72)			$comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
73)			return count($comments_by_type['comment']);
74)		} else {
75)			return $count;
76)		}
77)	}


How can this be corrected?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xdevelx, 2021-12-18
@nova74

Remove the ampersand & before calling the separate_comments() function - it is not needed there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question