{"id":26793241,"url":"https://github.com/beapi/acf-options-for-polylang","last_synced_at":"2026-03-04T09:04:20.395Z","repository":{"id":47471950,"uuid":"53422355","full_name":"BeAPI/acf-options-for-polylang","owner":"BeAPI","description":"A WordPress plugin for adding ACF options page support for Polylang.","archived":false,"fork":false,"pushed_at":"2026-02-15T14:25:16.000Z","size":568,"stargazers_count":178,"open_issues_count":22,"forks_count":30,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-02-15T17:06:51.262Z","etag":null,"topics":["acf","acf-options","options","polylang","wordpress-plugin"],"latest_commit_sha":null,"homepage":"https://wordpress.org/plugins/acf-options-for-polylang/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BeAPI.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-03-08T15:19:25.000Z","updated_at":"2026-02-12T15:18:43.000Z","dependencies_parsed_at":"2025-05-17T18:06:24.282Z","dependency_job_id":"95178bad-2295-4774-a27a-d7fb7afe50a5","html_url":"https://github.com/BeAPI/acf-options-for-polylang","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/BeAPI/acf-options-for-polylang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeAPI%2Facf-options-for-polylang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeAPI%2Facf-options-for-polylang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeAPI%2Facf-options-for-polylang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeAPI%2Facf-options-for-polylang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeAPI","download_url":"https://codeload.github.com/BeAPI/acf-options-for-polylang/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeAPI%2Facf-options-for-polylang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30076935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acf","acf-options","options","polylang","wordpress-plugin"],"created_at":"2025-03-29T16:19:34.944Z","updated_at":"2026-03-04T09:04:20.381Z","avatar_url":"https://github.com/BeAPI.png","language":"PHP","funding_links":["https://www.paypal.me/BeAPI"],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://beapi.fr\"\u003e![Be API Github Banner](.wordpress-org/banner-github.png)\u003c/a\u003e\n\n# BEA - ACF Options For Polylang\n\n[![CodeFactor](https://www.codefactor.io/repository/github/beapi/acf-options-for-polylang/badge)](https://www.codefactor.io/repository/github/beapi/acf-options-for-polylang)\n\nAre you using Advanced Custom Fields for option pages and Polylang for your multilingual site?\n\nPolylang does not natively support ACF Option Pages, so option values are shared across all languages.\n\nThis plugin improves that: Once activated, you’ll be able to set different values for each language. If a value isn’t set for a specific language, the “All languages” value will be used by default.\n\n# How does it work?\n\nThis plugin saves separate values for each language in the database. Polylang’s language settings are then used to fetch the appropriate value from the database. \u003cb\u003eNote: When you activate the plugin, your existing option values will be temporarily unavailable but remain in the database. You can recover them by deactivating the plugin.\u003c/b\u003e\n\nTo set or update your option pages in a specific language, simply use the Polylang language flags in the WordPress admin bar (the integrated language switcher) to select your desired language before editing the options.\n\n# Requirements\n\n- [WordPress](https://wordpress.org/) 6.0+ / Tested from 6.0 to latest\n- PHP 7.4 to 8.4 / Tested from 7.4 to 8.4\n- [Advanced Custom Fields](https://www.advancedcustomfields.com/pro) 5.6.0+\n- [Polylang](https://polylang.pro/) (tested up to 3.7.7)\n\n# Installation\n\nFirst activate and configure Polylang in you site.\nThen activate ACF Options For Polylang to handle ACF Options in setted Polylang's languages.\n\n## WordPress\n\n- Download and install using the built-in WordPress plugin installer.\n- Site activate in the \"Plugins\" area of the admin.\n- Optionally drop the entire `acf-options-for-polylang` directory into mu-plugins.\n- Nothing more, this plugin is ready to use !\n\n## [Composer](http://composer.rarst.net/)\n\n- `composer require wpackagist-plugin/acf-options-for-polylang`\n- Nothing more, this plugin is ready to use !\n\n# What ?\n\n## Contributing\n\nPlease refer to the [contributing guidelines](.github/CONTRIBUTING.md) to increase the chance of your pull request to be merged and/or receive the best support for your issue.\n\n### Testing\n\nThis plugin includes a comprehensive unit test suite: **61 tests**, **92 assertions**, **0 skips**. Tests run with Polylang fully initialized via wp-env.\n\nQuick start:\n```bash\nnpm install \u0026\u0026 composer install\nnpm run wp-env:start\nnpm run test:unit\n```\n\nSee [TESTING.md](TESTING.md) for detailed testing documentation, test matrix, and writing guidelines.\n\n### Issues \u0026 features request / proposal\n\nIf you identify any errors or have an idea for improving the plugin, feel free to open an [issue](../../issues/new). Please provide as much info as needed in order to help us resolving / approve your request.\n\n## For developers\n\n## Using fields\n\nNothing change, we have made all the hooks for you, so no need to prefix your fields with a lang or something else.\nOnly use ACF's helpers to get and show the fields as you did before with [get_field()](https://www.advancedcustomfields.com/resources/get_field/) or the_field() :\n\n`get_field( 'footer_disclaimer', 'options' );`\n\n## Excluding Option Pages from Localization\n\nIf you want to prevent this plugin from applying its functionality to a specific ACF options page, you can exclude it by adding its `post_id` to the exclusion filter.\n\nAdd the following code to your theme or custom plugin (replace `'custom_options_page_post_id'` with your actual options page post ID):\n\n```php\nadd_filter( 'bea.aofp.excluded_post_ids', function( $ids ) {\n    $ids[] = 'custom_options_page_post_id'; // Exclude this options page from localization\n    return $ids;\n}, 10, 1 );\n```\n\nThis will ensure that the specified options page is not affected by language-specific behavior and will always load/save its values without localization.\n\n## Language attribute for option key suffix\n\nBy default, the plugin uses Polylang’s **locale** (e.g. `fr_FR`, `en_US`) as the suffix for option keys. You can switch to **slug** (e.g. `fr`, `en`) or another Polylang language field.\n\n**Option 1 – Constant** (e.g. in `wp-config.php`, before the plugin loads):\n\n```php\ndefine( 'BEA_ACF_OPTIONS_FOR_POLYLANG_LANG_ATTRIBUTE', 'slug' );\n```\n\n**Option 2 – Filter** (in theme or plugin):\n\n```php\nadd_filter( 'bea.aofp.lang_attribute', function( $attribute ) {\n    return 'slug'; // or 'locale', 'name', etc.\n} );\n```\n\nThe value must be a valid Polylang attribute for `pll_current_language()` / `pll_languages_list()` (e.g. `locale`, `slug`, `name`).\n\n## Default Values (“All languages” Fallback)\n\nBy default, this plugin will use the Polylang “All languages” value when there is no value set for the current language. If you prefer not to use this fallback behavior, you can easily disable it using a filter.\n\n### Disable fallback for all ACF Options pages\n\nAdd this code to your theme or plugin:\n```php\nadd_filter( 'bea.aofp.get_default', '__return_false' );\n```\n\n### Disable fallback for a specific ACF Options page\n\nYou can target a single ACF Options page using the `$post_id` parameter:\n```php\nadd_filter( 'bea.aofp.get_default', function( $show_default, $post_id ) {\n\tif ( 'my_custom_acf_option_post_id' === $post_id ) {\n\t\t// Disable default fallback for this specific ACF Options page\n\t\treturn false;\n\t}\n\n\treturn $show_default;\n}, 10, 2 );\n```\n\n\u003e **Note**: If you change this value dynamically or rely on the default/all languages fallback, you may sometimes need to clear ACF's internal cache so that your changes are properly recognized.  \nTo do this, use:\n```php\n// Clear ACF store\n$store = acf_get_store('values');\n$store-\u003ereset();\n```\n— this will force ACF to reload the values from the database on the next request.\n\n## Loading untranslated (default) option values\n\nWhen you need to read the **default / untranslated** values (the ones stored without a language suffix, used as fallback when no translation exists), use the context switch API. This applies to all fields, including repeater sub-fields and relationship fields.\n\n### Switch / restore context\n\n- **`bea_aofp_switch_to_untranslated()`** — subsequent `get_field( ..., option_page_id )` and `have_rows( ..., option_page_id )` will load values from the unsuffixed key (default values).\n- **`bea_aofp_restore_current_lang()`** — restores the previous context; option values are again loaded for the current language.\n\nCalls can be nested: each `restore_current_lang()` undoes the last `switch_to_untranslated()`.\n\n### Example\n\n```php\n// Current language values\n$title = get_field( 'site_title', 'theme-general-settings' );\n\n// Temporarily load default (untranslated) values\nbea_aofp_switch_to_untranslated();\n$default_title = get_field( 'site_title', 'theme-general-settings' );\nif ( have_rows( 'links', 'theme-general-settings' ) ) {\n\twhile ( have_rows( 'links', 'theme-general-settings' ) ) {\n\t\tthe_row();\n\t\t$default_related_post = get_sub_field( 'related_post' ); // Also uses default context\n\t}\n}\nbea_aofp_restore_current_lang();\n\n// Back to current language\n$title_again = get_field( 'site_title', 'theme-general-settings' );\n```\n\n# Who ?\n\nCreated by [Be API](https://beapi.fr), the French WordPress leader agency since 2009. Based in Paris, we are more than 30 people and always [hiring](https://beapi.workable.com) some fun and talented guys. So we will be pleased to work with you.\n\nThis plugin is only maintained, which means we do not guarantee some free support. Consider reporting an [issue](#issues--features-request--proposal) and be patient.\n\nIf you really like what we do or want to thank us for our quick work, feel free to [donate](https://www.paypal.me/BeAPI) as much as you want / can, even 1€ is a great gift for buying cofee :)\n\n## License\n\nBEA - ACF Options for Polylang is licensed under the [GPLv2 or later](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeapi%2Facf-options-for-polylang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeapi%2Facf-options-for-polylang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeapi%2Facf-options-for-polylang/lists"}