Title: Parse Error: Syntax error in faq class.php
Last modified: August 31, 2016

---

# Parse Error: Syntax error in faq class.php

 *  Resolved [Sammickk](https://wordpress.org/support/users/sammickk/)
 * (@sammickk)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-in-faq-classphp/)
 * Website was working fine, did not change anything and off of a sudden i try to
   go to my website and see this message
    “Parse error: syntax error, unexpected‘[‘
   in /home4/sammickk/public_html/wp-content/plugins/faq-wd/faq_class.php on line
   27”
 * Removed the plugin via CPanel from my host and website is back up.
    Tried to 
   re install the plugin and when i tried to activate it, WP will not let me activate
   it because it generates that error again. Here is a copy and paste of faq_class.
   php `<?php
 * class faq_class {
 *  protected static $instance = null;
    public $cpt; public $shortcode_tag = ‘faq_wd’;
   public $post_type = ‘faq_wd’; public $version = ‘1.0.11’;
 *  private function __construct() {
    $this->includes(); require_once ‘lang/SLangClass.
   php’; FAQWDLangClass::get_instance(‘faq_wd’, ‘faq-wd’); //new FAQWDLangClass(‘
   faq_wd’, ‘faq-wd’); add_action(‘init’, array($this, ‘add_localization’)); add_action(‘
   wp_enqueue_scripts’, array($this, ‘register_front_end_styles’)); add_action(‘
   wp_enqueue_scripts’, array($this, ‘register_front_end_scripts’)); add_action(‘
   wp_ajax_faq_wd_vote’, array($this, ‘faq_wd_vote’)); add_action(‘wp_ajax_nopriv_faq_wd_vote’,
   array($this, ‘faq_wd_vote’)); add_filter(‘the_content’, array($this, ‘faqwd_custom_template’));}
 *  public function add_localization() {
    $contLDomain = “faqwd”; $locale = get_locale();
   $path = WP_CONTENT_DIR . ‘/uploads/Languages_WD/’ . explode(‘/’, plugin_basename(
   __FILE__))[0] . ‘/faq-wd-‘ . $locale . ‘.mo’; $loaded = load_textdomain($contLDomain,
   $path); if (isset($_GET[‘page’]) && $_GET[‘page’] == basename(__FILE__) && !$
   loaded) { echo ‘<div class=”error”> Staff Directory WD ‘ . __(‘Could not load
   the localization file: ‘ . $path, $contLDomain) . ‘</div>’; return; } }
 *  public function includes() {
    global $faqwd_options; include_once(‘includes/
   register_settings.php’); $faqwd_options = faqwd_get_settings(); include_once(‘
   includes/faq_cpt_class.php’); $this->cpt = faq_cpt::get_instance(); include_once(‘
   includes/shortcode.php’); }
 *  function register_front_end_styles() {
    global $faqwd_options; wp_register_style(‘
   front_end_style’, FAQ_URL . ‘css/front_end_style.css’, array(), $this->version);
   wp_enqueue_style(‘front_end_style’); wp_register_style(‘front_end_default_style’,
   FAQ_URL . ‘css/default.css’, array(), $this->version); wp_enqueue_style(‘front_end_default_style’);
   if (isset($faqwd_options[‘answer_scroll’]) && $faqwd_options[‘answer_scroll’]!
   = “” && intval($faqwd_options[‘answer_scroll’] != 0)) { $height = $faqwd_options[‘
   answer_scroll’]; $css = “.faqwd_answer_container{overflow-y: scroll;max-height:”.
   $height . “px;height:” . $height . “px}”; wp_add_inline_style(‘front_end_style’,
   $css); } }
 *  function register_front_end_scripts() {
 *  wp_register_script(‘vote_button’, FAQ_URL . ‘js/vote.js’, array(‘jquery’,
    ‘
   jquery-ui-widget’), $this->version, true); wp_enqueue_script(‘vote_button’); 
   wp_register_script(‘front_js’, FAQ_URL . ‘js/faq_wd_front_end.js’, array(‘jquery’,‘
   jquery-ui-widget’), $this->version, true); wp_enqueue_script(‘front_js’);
 *  wp_localize_script(‘vote_button’, ‘faqwd’, array(‘ajaxurl’ => admin_url(‘admin-
   ajax.php’),
    ‘ajaxnonce’ => wp_create_nonce(‘faqwd_ajax_nonce’), ‘loadingText’
   => __(‘Loading…’, ‘faqwd’))); }
 *  function faq_wd_vote() {
    $post_id = $_POST[‘post_id’]; $type = $_POST[‘type’];
   if ($type == ‘hits’) { $hits = 1; $faqwd_hits = get_post_meta($post_id, ‘faqwd_hits’,
   true); if ($faqwd_hits != null) { $hits = (int) $faqwd_hits + 1; }
 *  update_post_meta($post_id, ‘faqwd_hits’, $hits);
    echo json_encode(array(“hits”
   => $hits)); die; } else {
 *  $count = array();
    $current_ip = $_SERVER[‘REMOTE_ADDR’]; $exists_ips = get_option(‘
   faqwd_voted_ips’); $exists_ips = json_decode($exists_ips, true); if (isset($exists_ips[
   $post_id]) && is_array($exists_ips[$post_id])) { if (!in_array($current_ip, $
   exists_ips[$post_id])) { $exists_ips[$post_id][] = $current_ip; $count = $this-
   >useful_non_useful($type, $post_id); update_option(‘faqwd_voted_ips’, json_encode(
   $exists_ips)); } else { $count_useful = get_post_meta($post_id, ‘faqwd_useful’,
   true); (isset($count_useful) && $count_useful != ”) ? $count[‘useful’] = $count_useful:
   $count[‘useful’] = 0; $count_non_useful = get_post_meta($post_id, ‘faqwd_non_useful’,
   true); (isset($count_non_useful) && $count_non_useful != ”) ? $count[‘non_useful’]
   = $count_non_useful : $count[‘non_useful’] = 0; } } else { $exists_ips[$post_id]
   = array($current_ip); update_option(‘faqwd_voted_ips’, json_encode($exists_ips));
   $count = $this->useful_non_useful($type, $post_id); } echo json_encode(array(‘
   useful’ => $count[‘useful’], ‘non_useful’ => $count[‘non_useful’])); die; } }
 *  function useful_non_useful($type, $id) {
 *  $useful_arr = get_post_meta($id, ‘faqwd_useful’);
    $non_useful_arr = get_post_meta(
   $id, ‘faqwd_non_useful’); ( isset($useful_arr[0]) ) ? $useful = $useful_arr[0]:
   $useful = 0; ( isset($non_useful_arr[0]) ) ? $non_useful = $non_useful_arr[0]:
   $non_useful = 0;
 *  if ($type == ‘useful’) {
    $useful = (int) $useful + 1; update_post_meta($id,‘
   faqwd_useful’, $useful); } else { $non_useful = (int) $non_useful + 1; update_post_meta(
   $id, ‘faqwd_non_useful’, $non_useful); } $count = array(‘useful’ => $useful, ‘
   non_useful’ => $non_useful); return $count; }
 *  public function faqwd_custom_template($content) {
    global $post; if (is_single()){
   if ($post->post_type == ‘faq_wd’) { ob_start(); include(FAQ_DIR . ‘/views/faq_wd_content.
   php’); $faq_content = ob_get_clean(); $content = $faq_content; } } return $content;}
 *  /**
    * Return an instance of this class. */ public static function get_instance(){
   if (null == self::$instance) { self::$instance = new self; } return self::$instance;}
 * }
 * ?>
 * [https://wordpress.org/plugins/faq-wd/](https://wordpress.org/plugins/faq-wd/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [mbcoulter](https://wordpress.org/support/users/mbcoulter/)
 * (@mbcoulter)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-in-faq-classphp/#post-7018779)
 * I am able to confirm the error on my site too after upgrading to the FAQ version
   1.0.11. The previous version 1.0.10 did not have this error:
 * PHP Parse error: syntax error, unexpected ‘[‘ in /xxxxxxxxxxxx/wp-content/plugins/
   faq-wd/faq_class.php on line 27
 * This is running on WP version 4.4.1
 *  [jckuffner](https://wordpress.org/support/users/jckuffner/)
 * (@jckuffner)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-in-faq-classphp/#post-7018788)
 * Since I want this plugin to work I commented out the offending section – it’s
   the method related to localization which I don’t use in the website I have running
   the plugin.
 *     ```
       public function add_localization() {
       /*$contLDomain = "faqwd";
       $locale = get_locale();
       $path = WP_CONTENT_DIR . '/uploads/Languages_WD/' . explode('/', plugin_basename(__FILE__))[0] . '/faq-wd-' . $locale . '.mo';
       $loaded = load_textdomain($contLDomain, $path);
       if (isset($_GET['page']) && $_GET['page'] == basename(__FILE__) && !$loaded) {
       echo '<div class="error"> Staff Directory WD ' . __('Could not load the localization file: ' . $path, $contLDomain) . '</div>';
       return;
       }*/
       }
       ```
   
 * This should do until the plugin is fixed.
 *  [Sona](https://wordpress.org/support/users/support-web-dorado/)
 * (@support-web-dorado)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-in-faq-classphp/#post-7018818)
 * Dear users,
 * Soon we will release an update which will resolve the stated issue. Thank you.
 *  [mbcoulter](https://wordpress.org/support/users/mbcoulter/)
 * (@mbcoulter)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-in-faq-classphp/#post-7018846)
 * Excellent. Thanks for the quick response!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Parse Error: Syntax error in faq class.php’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/faq-wd_06487b.svg)
 * [10WebFAQ](https://wordpress.org/plugins/faq-wd/)
 * [Support Threads](https://wordpress.org/support/plugin/faq-wd/)
 * [Active Topics](https://wordpress.org/support/plugin/faq-wd/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/faq-wd/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/faq-wd/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [mbcoulter](https://wordpress.org/support/users/mbcoulter/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-in-faq-classphp/#post-7018846)
 * Status: resolved