-
Author
-
April 2, 2017 at 17:13 #157394alans77Participant
Hi
I get a blank page, when I add this code to my functions.php.
The code is from WPML – this is my ticket – https://wpml.org/forums/topic/one-shop-page-for-all-languages/.
add_action(
'wp_insert_post'
,
'my_duplicate_on_publishh'
);
function
my_duplicate_on_publishh(
$post_id
) {
$post
= get_post(
$post_id
);
// don't save for autosave
if
( defined(
'DOING_AUTOSAVE'
) && DOING_AUTOSAVE ) {
return
$post_id
;
}
// dont save for revisions
if
( isset(
$post
->post_type ) &&
$post
->post_type ==
'revision'
) {
return
$post_id
;
}
//insert your custom post type here
if
(
$post
->post_type ==
'product'
):
// we need this to avoid recursion see add_action at the end
remove_action(
'wp_insert_post'
,
'my_duplicate_on_publishh'
);
// make duplicates if the post being saved
// #1. itself is not a duplicate of another or
// #2. does not already have translations
$is_translated
= apply_filters(
'wpml_element_has_translations'
,
''
,
$post_id
,
$post
->post_type );
if
( !
$is_translated
) {
do_action(
'wpml_admin_make_post_duplicates'
,
$post_id
);
}
// must hook again - see remove_action further up
add_action(
'wp_insert_post'
,
'my_duplicate_on_publishh'
);
endif
;
}
The code works with the deault theme – Twenty Seventeen, but not with Kleo.
Thanks for your help – Alan
April 3, 2017 at 12:20 #157441AbeKeymasterHi, enable
Please update the theme to latest version and the afferent plugins, you can check the plugin update status from wp-admin -> appearance -> install plugins.Please follow these steps to enable wp debug:
- Connect to your server by FTP
- Look in root directory of your WordPress install and open wp-config.php
- Search for define( ‘WP_DEBUG’, false ); and change FALSE value to TRUE
COPY CODEdefine( 'WP_DEBUG', true );
- After this line add this:
COPY CODEdefine( 'WP_DEBUG_LOG', true );
WP_DEBUG_LOG is a companion to WP_DEBUG that causes all errors to also be saved to a debug.log log file inside the /wp-content/ directory. This is useful if you want to review all notices later or need to view notices generated off-screen (e.g. during an AJAX request or wp-cron run).
Repeat the described actions and then check the debug.log file and let me know what error appears.
Cheers
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
The forum ‘Bugs & Issues’ is closed to new topics and replies.