WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Fatal Error in Comment Posting (add_magic_quotes) (3 posts)

  1. benjancewicz
    Member
    Posted 5 years ago #

    I'm getting the following error on this site whenever I try to post a comment.

    Fatal error: Cannot redeclare add_magic_quotes() (previously declared in /home/content/r/y/a/ryanpaugh/html/wp-comments-post.php:4) in /home/content/r/y/a/ryanpaugh/html/wp-includes/functions.php on line 1257

    Any idea what could possibly be causing it? I deactivated all my plugins, and it didn't do anything.

  2. benjancewicz
    Member
    Posted 5 years ago #

    Line 4 of wp-comments-post.php looks like this:

    function add_magic_quotes($array) {
    	foreach ($array as $k => $v) {
    		if (is_array($v)) {
    			$array[$k] = add_magic_quotes($v);
    		} el se {
    			$array[$k] = addslashes($v);
    		}
    	}
    	return $array;
    }

    Line 1257 of functions.php looks like this:

    function add_magic_quotes( $array ) {
    	global $wpdb;
    
    	foreach ( (array) $array as $k => $v ) {
    		if ( is_array( $v ) ) {
    			$array[$k] = add_magic_quotes( $v );
    		} else {
    			$array[$k] = $wpdb->escape( $v );
    		}
    	}
    	return $array;
    }
  3. benjancewicz
    Member
    Posted 5 years ago #

    Reinstalled. It fixed it.

Topic Closed

This topic has been closed to new replies.

About this Topic