WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Polylang] pll_default_language errors. (3 posts)

  1. Nerdvous
    Member
    Posted 1 year ago #

    First of all, kudos on adding a default language function in the api and saving the others some code maintenance.

    That being said ... the function is full of typos. :)
    They all probably came from copy pasting code around. I managed to fix it, but it'd be really nice to fix it on your end in the next release.

    function pll_default_language($arg = 'slug') {
    	global $polylang;
    	return !(isset($polylang) && ($options = get_options('polylang')) && isset($options['default-lang']) && $lang = $polylang->get_language($options['default-lang'])) ? false :
    		($args == 'name' ? $lang->name :
    		($args == 'locale' ? $lang->description :
    		$lang->slug));
    }

    There are 3 of them:
    -1: The function argument is $arg, but are trying to get the values from $args.
    -2: The get_option function is misspelled (has an 's' at the end).
    -3: The key for the default language options is 'default_lang', not 'default-lang' (underscore vs hyphen (i checked the database)).

    After that the function worked like a charm.

    Again - Great new feature (for the developers). Just needs a bit more tweaking. :)

    http://wordpress.org/extend/plugins/polylang/

  2. Chouby
    Member
    Posted 1 year ago #

    Thank you for your support! I am already aware of these issues (http://wordpress.org/support/topic/pll_default_language-function-bug) that will of course be corrected in the next release.

  3. Nerdvous
    Member
    Posted 1 year ago #

    Thanks for the fast reply (and sorry i'm a little late).

    Apologies for reporting an already posted issue. I could not find the topic you referenced on my own when i wrote it.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags