Support » Plugin: Add Polylang support for Customizer » Wrong Permalink on translated Custom Post Type name

  • Resolved dst89

    (@dst89)


    Hello,

    since I installed your Plugin to translate my theme customizer,
    the permalinks of my custom post types are no longer translated.

    I created some CPT with rewrite slug

    
    register_post_type('engineering',
    		array(
    			'label' => __('Anlagenbau'),
    			'public' => true,
    			'show_ui' => true, // not in use
    			'menu_icon' => 'dashicons-hammer',
    			'has_archive' => true,
    			'show_in_nav_menus' => true,
    			'rewrite' => array(
    				'slug' => _x('engineering', 'Custom Post Type slug', 'dupp'),
    				'with_front' => true
    			),
    			'supports' => array(
    				'title',
    				'editor',
    				'thumbnail',
    				'custom-fields',
    				'revisions',
    				'comments',
    				'excerpt'
    			),
    			'show_in_rest' => true,
    		)
    	);
    

    Before I installed the Plugin the Post permalinks were:

    EN: https://domain.de/en/engineering/Control-System/
    DE: https://domain.de/anlagenbau/steuerungstechnik/

    After I installed the Plugin the Post permalinks are:

    EN: https://domain.de/engineering/Control-System/ WRONG!
    DE: https://domain.de/engineering/steuerungstechnik/ WRONG!

    In addition, the option for URL modifications option
    “The language is set from the code in the URL” can no longer be saved in the polylang-plugin. After reload of the settings, the option is set to “The langugage is set from content” again.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author richardevcom

    (@richardevcom)

    Thank you for reporting this.
    I will dive into this and see workaround to this.

    Can you please enable debugging and check for errors too?

    Debug is true – there ist no error in debug.log.

    But I found this in includes/class-apsfc.php

    
    /**
    		 * Force "The language is set from content" (in Language->Settings->URL modifications)
    		 */
    		$options = get_option( 'polylang' );
    		if ( isset( $options['force_lang'] ) && 0 !== $options['force_lang'] ) {
    			$options['force_lang'] = 0;
    			update_option( 'polylang', $options );
    		}
    

    Thats why I can’t change the setting to “The language is set from the code in the URL”

    //Edit: I changed to use pll_register_string to translate my theme-customizer… so I did not need the plugin anymore. But I think it’s a good plugin already, if it works properly.

    • This reply was modified 4 months, 2 weeks ago by dst89.
    Plugin Author richardevcom

    (@richardevcom)

    Thank you for this report. I will update it in following days. I will update you on progress.

    I just ran into the same problem — thanks for fixing it!

    Plugin Author richardevcom

    (@richardevcom)

    Allright, soo I will have to make some sort of settings page, so users can choose whether force “The language is set from content” or not.

    		/**
    		 * Force "The language is set from content" (in Language->Settings->URL modifications)
    		 */
    		$options = get_option( 'polylang' );
    		if ( isset( $options['force_lang'] ) && 0 !== $options['force_lang'] ) {
    			$options['force_lang'] = 0;
    			update_option( 'polylang', $options );
    		}
    Plugin Author richardevcom

    (@richardevcom)

    I’ve updated the plugin with Settings page under Polylang and quiclink in Plugins list for it, where you can edit this Forcing option. Please update the plugin. No more issues with that. Thank you guys for reporting again! <3

    Fast & friendly support

    Hi Richard,

    I just tried the update but unfortunately it does not work for me.
    See screencast: https://www.dropbox.com/s/1s7gotwlyelgfg8/PolylangCustomizer.mp4?dl=0

    Plugin versions:
    Add Polylang support for Customizer: 1.1.3
    Polylang Pro: 2.7.3

    Plugin Author richardevcom

    (@richardevcom)

    @moargh not sure if still related, but please update the plugin and check if it’s fixed. It only forces that setting when it’s checked in Customizer Support settings. Basically always overwriting the setting. When unchecked it won’t change it in Polylang settings.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.