Updating Nelio via remote publish
-
So, to start off; the following code works perfectly fine with either publishing a new post manually or hitting update.
add_action('xmlrpc_publish_post', 'nelioefi_update_url' ); add_action('the_post', 'nelioefi_update_url' ); add_action('save_post', 'nelioefi_update_url' ); add_action('draft_to_publish', 'nelioefi_update_url' ); add_action('new_to_publish', 'nelioefi_update_url' ); add_action('pending_to_publish', 'nelioefi_update_url' ); add_action('future_to_publish', 'nelioefi_update_url' ); function nelioefi_update_url( $post_id ) { // get the post object $post = get_post( get_the_ID() ); // we need just the content $content = $post->post_content; // we need a expression to match things $regex = '/src="([^"]*)"/'; // we want all matches preg_match_all( $regex, $content, $matches ); // reversing the matches array $matches = array_reverse($matches); $urlplz = print_r($matches[0][0], true); if ( $urlplz ) update_post_meta( $post_id, _nelioefi_url(), $urlplz ); } function remove_images( $content ) { $postOutput = preg_replace('/<img[^>]+./','', $content); return $postOutput; } add_filter( 'the_content', 'remove_images', 100 );
After failing repeatedly trying a multitude of things to get it to update _nelioefi_url() when remote publishing, its finally just occured to me that maybe something should/could be changed in the nelio files. So hoping maybe you can shed some light or someone else.
thanks.
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Updating Nelio via remote publish’ is closed to new replies.