run script on publish
It looks like it could be because the filter cannot find the include file. Try using: include( ABSPATH. “/path/to/file/jobsfeed.php” )
It looks like it could be because the filter cannot find the include file. Try using: include( ABSPATH. “/path/to/file/jobsfeed.php” )
When a post is published/saved, it does not do it in a single script execution. It redirects to a different script, does the save, then redirects back to where you started. If you want to confirm that your hook is working, use update_option(), and delete the option immediately after displaying it so it’s not latent … Read more
Simply search your templates for post_password_required() and wrap it into if ( ! is_user_logged_in() ).
why use a custom table for this? eliminate the whole save_post function and just use get_post_meta and update_post_meta to check/increment the view count. this is exactly what post meta data is for.
so you need to correct your nonce field add a second pram nonce name, more information on WordPress codex here // wp nonce field wp_nonce_field( $action, $name, $referer, $echo ); // replace yours with below wp_nonce_field( ‘ind_pricing_table_box_nonce’, ‘ind_pricing_nonce’ ); now verify your nonce, more info here wp_verify_nonce( $nonce, $action ); // replace yours with below … Read more
You can use transition_post_status function, then fetch users and send an email to all users. Here is a sample code, it’s not tested. But it will get you started with this. function wcs_send_mail_on_publish_category_posts( $new_status, $old_status, $post ) { global $post; if ( ‘publish’ !== $new_status or ‘publish’ === $old_status ) return; if ( in_category( array( … Read more
Perhaps this solution will work: var flag_ok = false; $(‘#publish’).on(‘click’, function (e) { if ( ! flag_ok ) { e.preventDefault(); var url = shiftajax.ajaxurl; var shift = $(‘#post_ID’).val(); var data = { ‘action’: ‘wpaesm_check_for_schedule_conflicts_before_publish’, ‘shift’: shift, }; $.post(url, data, function (response) { if( response.action == ‘go’ ) { // there aren’t any scheduling conflicts, so … Read more
You can try using wp_insert_post_data for the task. Something like: function assign_new_post_to_specific_author( $data , $postarr ) { // Where author_ID is the ID of the author you want to assign the new post $data[‘post_author’] = author_ID; return $data; } add_filter( ‘wp_insert_post_data’, ‘assign_new_post_to_specific_author’, ’99’, 2 ); Tried it on c9.io and it works, but you need … Read more
you can see all of wordpress action hooks here – I would suggest looking into something like “updated_postmeta” or similar for you
It is not possible to modify the post submit meta boxes with a filter. But you can do that with JavaScript. This script will generate 10-12 random alphanumeric string and put it in the password field (if it is empty) when you click the Password protected radio button. $(‘#visibility-radio-password’).click(function () { // If there is … Read more