Fatal Error Upon Activation

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Fatal Error Upon Activation

This topic contains 2 replies, has 2 voices, and was last updated by Webcentrex Webcentrex 9 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3338
    Webcentrex
    Webcentrex
    Participant

    Upon activation, receiving a:

    Fatal error: Cannot redeclare current_page_url() (previously declared in /home/lawdev/public_html/wp-content/plugins/ajax-search-pro/functions.php:61) in /home/lawdev/public_html/wp-content/themes/multipurpose/functions.php on line 257

    on both the front end and back. I currently have it disabled and ready to play with again – if you don’t have an immediate “quick fix” response, please let me know and I can supply gateway and user/pass for WP.

    Thanks in advance! 🙂

    Alex
    Webcentrex LLC

    #3343
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Sure thing. It looks like your theme is declaring the same function used in the plugin, but it doesn’t check if it already exsists. The issue is not related to the search plugin per se, but I will help you anyways.

    Based on the error messages if you open up the themes functions.php file and go to line 257, you will see something like this:

    
    function current_page_url() {
       ...
       ...
    }
    

    The { and } brackets indicate the beginning and the end of the function. The ending } bracked should be a few lines below line 257. Now, the best solution is to wrap this piece of code into an if statement. This is the standard way to check wether the function is already declared. So you need to wrap the function code like this:

    
    if (!function_exists("current_page_url")) {
       function current_page_url() {
          ...
          ...
       }
    }
    

    This will fix it immediately. Please also notice the theme developer to wrap all of the functions in his theme functions.php file in such way, because it may cause conflicts with other plugins as well.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #3369
    Webcentrex
    Webcentrex
    Participant

    Thank you sir! 🙂

    Thank you for the explanation and the fix – plugin is now active and we are error free! NOW to have some fun… ** insert evil mad scientist laugh here **

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.