This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 5 replies, has 2 voices.
Last updated by Itamar 4 years, 8 months ago.
Assisted by: Itamar.
Author | Posts |
---|---|
August 19, 2019 at 12:25 pm #4415925 | |
Willem |
We sometimes get a 404 on a custom posttype, and i'm aware it can be resolved by saving the 'Permalink Settings'. However, i don't want my client to press this button every time he/she modifies some content and i don't want to add a flush_rewrite_rules() to each individual request, since that have a severe impact on page-speed. I'm not sure what causes the problem, but i don't think it is the correct way to have to save the permalink settings each time you modify some content. So my questions are: |
August 19, 2019 at 6:28 pm #4418297 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi. This is not expected behavior, and if everything is correct and updated, it shouldn't happen. Regards, |
August 20, 2019 at 7:49 am #4421119 | |
Willem |
I'm not a 100% sure when this occurs, but i do know it happened after new content was added or modified in another language. If i had to guess, it seems the permalinks are only saved for the language the editor was working in, and the other languages will give 404-errors. |
August 20, 2019 at 12:32 pm #4423657 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi and thanks for sharing the debug information with me. I can see that you are on a WordPress multisite installation. Therefore I cannot see the plugins that you use and whether everything is updated. Also please share with me the link to where I can see this issue (404 on translated CPT). You wrote: " If i had to guess, it seems the permalinks are only saved for the language the editor was working in, and the other languages will give 404-errors." Thanks, |
August 20, 2019 at 12:49 pm #4423707 | |
Willem |
We only use a bare minimum of plugins, see attached screenshot. register_post_type( EZZYS_VACANCIES_CPT, array( 'labels' => array( 'name' => __('Vacancy', EZZYS_ADMIN_TEXTDOMAIN), 'singular_name' => __('Vacancy', EZZYS_ADMIN_TEXTDOMAIN), 'all_items' => __('All Vacancies', EZZYS_ADMIN_TEXTDOMAIN), 'menu_name' => __('Vacancies', EZZYS_ADMIN_TEXTDOMAIN) ), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_rest' => true, 'menu_position' => 30, 'capability_type' => 'post', 'hierarchical' => false, 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'author'),//, 'page-attributes' 'has_archive' => false, 'rewrite' => array('slug' => __('vacancies', EZZYS_ADMIN_TEXTDOMAIN) . '/%'.EZZYS_VACANCIES_TAX.'%', 'with_front' => false, 'pages' => true), 'query_var' => true, 'menu_icon' => 'dashicons-id', ) ); for now i think i 'resolved' the issue by adding add_action('save_post', 'flush_rewrite_rules'); the translations are added by clicking on the '+' button in wp-admin in the english-flag-column. I don't think there are any problems with translating wrong, i think the problem might be caused by the 'rewrite' part when registering our CPT. |
August 21, 2019 at 11:17 am #4430659 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi. I'm glad that you have found a workaround for this issue. It is hard for me to help you when custom code is involved. This would be out of the scope of this support forum. Nevertheless, you might find helpful information et the following link where we present a known related issue (Not a bug). https://wpml.org/errata/htaccess-is-rewritten-with-language-folder/ Please let me know if you have further questions about this case. Regards, |