Home Forums ACF PRO Global AND Translated Options Page with WPML / acfml


Global AND Translated Options Page with WPML / acfml

  • Hey

    I want to have to different types of Option Pages.

    • Global Options
    • Translated Options

    The setup is:

    • Advanced Custom Fields PRO | 5.7.13
    • WPML Multilingual CMS | 4.2.6
    • Advanced Custom Fields Multilingual | 1.1
    • WPML String Translation | 2.10.4
    • WPML Media | 2.5.2

    With this setup, I get “only” the “Translated” Options Pages.

    How can I get “Global” Options Pages too?
    Does anyone have experience with this? Tipps?

    Many thanks in advance – Peter

  • Hi John

    Thanks for the link, it helped me find a solution that works for me. Here it is!


    // Use this to force ACF to look for the "all" version of the fields.
    	add_filter('acf/settings/current_language', function() { return 'all' ; } );
    // Insert your regular ACF code between the add_filter and remove_filter lines.
    	echo get_field('my_language_independet_option_field', 'option');
    // Use this to re-enable language-specific retrieval of ACF fields.
    	remove_filter('acf/settings/current_language', function() { return ICL_LANGUAGE_CODE ; } );

    Backend- / Admin-Code (functions.php):

    function force_redirect_to_the__all__version_of_global_options() {
    	// correct page
    		global $pagenow ;
    		if($pagenow === "admin.php" && isset($_GET['page']) && $_GET['page'] === "global-options") { // global-options is the menu_slug you defined in acf_add_options_page
    			// lang not 'all'?
    				if(ICL_LANGUAGE_CODE !== 'all') {
    					// manipulate query (set lang to "all")
    						$query = $_GET;
    						$query['lang'] = 'all';
    						$query_result = http_build_query($query);
    					// redirect and die
    						wp_redirect(get_admin_url() . 'admin.php?' . $query_result);
    add_action( 'admin_init', 'force_redirect_to_the__all__version_of_global_options');
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.