This user has no favorite topics.
Favorite Forum Topics
Forum Topics Created
Status |
Topic
|
Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Performance Issues When Saving French Content with ACFML and WPML
Started by: yannP
in: English Support
Problem: Solution: 1. Navigate to \wp-content\plugins\sitepress-multilingual-cms\sitepress.class.php and modify the copy_custom_fields method as follows: function copy_custom_fields( $post_id_from, $post_id_to ) {<br /> $custom_fields_to_copy = $this->get_custom_fields_translation_settings( WPML_COPY_CUSTOM_FIELD );<br /> $custom_fields_from = get_post_meta( $post_id_from );<br /> $custom_fields_to = get_post_meta( $post_id_to );<br /><br /> foreach ( $custom_fields_to_copy as $meta_key ) {<br /> if ( array_key_exists( $meta_key, $custom_fields_from ) ) {<br /> $meta_from = isset( $custom_fields_from[ $meta_key ] ) ? $custom_fields_from[ $meta_key ] : [];<br /> $meta_to = isset( $custom_fields_to[ $meta_key ] ) ? $custom_fields_to[ $meta_key ] : [];<br /><br /> if ( $meta_from || $meta_to ) {<br /> $this->sync_custom_field( $post_id_from, $post_id_to, $meta_key );<br /> }<br /> }<br /> }<br /><br /> $sync_deleted_fields = false;<br /> if ( apply_filters( 'wpml_sync_deleted_custom_fields', $sync_deleted_fields ) && $custom_fields_from && $custom_fields_to ) {<br /> $if_deleted_in_source_and_still_in_target = Logic::allPass([<br /> Obj::prop( Fns::__, $custom_fields_to ),<br /> pipe( Obj::prop( Fns::__, $custom_fields_from ), Logic::not() ),<br /> ]);<br /><br /> wpml_collect( $this->get_custom_fields_translation_settings( WPML_TRANSLATE_CUSTOM_FIELD ) )<br /> ->filter( $if_deleted_in_source_and_still_in_target )<br /> ->map(function ( $meta_key ) use ( $post_id_from, $post_id_to ) {<br /> $this->sync_custom_field( $post_id_from, $post_id_to, $meta_key );<br /> });<br /> }<br />} 2. Navigate to \wp-content\plugins\sitepress-multilingual-cms\classes\custom-field-translation\class-wpml-copy-once-custom-field.php and modify the copy method as follows: public function copy( $post_id ) {<br /> $custom_fields_to_copy = $this->sitepress->get_custom_fields_translation_settings( WPML_COPY_ONCE_CUSTOM_FIELD );<br /> if ( empty( $custom_fields_to_copy ) ) {<br /> return;<br /> }<br /><br /> $source_element_id = $this->wpml_post_translation->get_original_element( $post_id );<br /> $custom_fields = get_post_meta( $post_id );<br /><br /> foreach ( $custom_fields_to_copy as $meta_key ) {<br /> if ( array_key_exists( $meta_key, $custom_fields ) ) {<br /> $values = isset( $custom_fields[ $meta_key ] )<br /> && ! empty( $custom_fields[ $meta_key ] )<br /> ? [ $custom_fields[ $meta_key ] ]<br /> : [];<br /><br /> $values = apply_filters(<br /> 'wpml_custom_field_values',<br /> $values,<br /> [<br /> 'post_id' => $post_id,<br /> 'meta_key' => $meta_key,<br /> 'custom_fields_translation' => WPML_COPY_ONCE_CUSTOM_FIELD,<br /> ]<br /> );<br /><br /> if ( empty( $values ) && $source_element_id ) {<br /> $this->sitepress->sync_custom_field( $source_element_id, $post_id, $meta_key );<br /> }<br /> }<br /> }<br />} If this solution does not resolve your issue or seems irrelevant due to updates or different circumstances, please check related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we highly recommend opening a new support ticket at WPML support forum. |
2 | 8 | 1 month, 3 weeks ago | ||
Lot of duplicate queries slowing down our website
Started by: yannP in: English Support |
3 | 4 | 6 months, 2 weeks ago | ||
[Unknown column 'language_code' in 'where clause']
Started by: yannP in: English Support |
2 | 2 | 3 years, 9 months ago |