function set_default_meta($post_ID){
$current_field_value = get_post_meta($post_ID,'source',true);
$default_meta1 = '<a href="" target_="blank" rel="nofollow"></a>'; //значения полей
$default_meta2 = '';
$default_meta3 = '<img src="" title="Avatar" alt="Avatar"/>';
$default_meta4 = '';
$default_meta5 = '';
if ($current_field_value == '' && !wp_is_post_revision($post_ID)){
add_post_meta($post_ID,'source',$default_meta1,true); //добавление самих полей
add_post_meta($post_ID,'author',$default_meta2,true);
add_post_meta($post_ID,'ava',$default_meta3,true);
add_post_meta($post_ID,'hobby1',$default_meta4,true);
add_post_meta($post_ID,'hobby2',$default_meta5,true);
}
return $post_ID;
}
add_action('wp_insert_post','set_default_meta');
location ~ \.php$ {
поменял на location / {
location / {
try_files $uri $uri/ /index.php;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires max;
}
add_action('register_post', 'binda_register_fail_redirect', 99, 3);
function binda_register_fail_redirect( $sanitized_user_login, $user_email, $errors ){
//this line is copied from register_new_user function of wp-login.php
$errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );
//this if check is copied from register_new_user function of wp-login.php
if ( $errors->get_error_code() ){
//setup your custom URL for redirection
$redirect_url = get_bloginfo('url') . '/registrace';
//add error codes to custom redirection URL one by one
foreach ( $errors->errors as $e => $m ){
$redirect_url = add_query_arg( $e, '1', $redirect_url );
}
//add finally, redirect to your custom page with all errors in attributes
wp_redirect( $redirect_url );
exit;
}
}