Horje
How to email the same page's content at regular intervals, automatically? - Wordpress Solution
I'd like to have the contents of a WP page emailed to me regularly, eg once a week. There are loads of plugins that will email a page when a button is pressed; and loads that will automatically create a newsletter which includes new blog post content, for example. But I just want the content of the same page each time - the content in question is a bit like a to-do list, and having it emailed to myself once a week (rather than simply when it has been updated) would be very useful. Any ideas?

Solution - 1

Try this

if (!wp_next_scheduled('my_task_hook')) {
	wp_schedule_event( time(), 'weekly', 'my_task_hook' );
}
add_action ( 'my_task_hook', 'my_task_function' );

function my_task_function() {
$my_postid = 1;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
	wp_mail( '<a rel="nofollow" href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="552c3a203038343c3915223d3027307b363a38">[email protected]</a>', 'this is the subject', $content );
}
function my_add_weekly( $schedules ) {
	// add a 'weekly' schedule to the existing set
	$schedules['weekly'] = array(
		'interval' => 604800,
		'display' => __('Once Weekly')
	);
	return $schedules;
}
add_filter( 'cron_schedules', 'my_add_weekly' ); 


Solution - 2

Do you like any plugin which sends email when content of the page is changed ?? If yes then I will tweek it to send you mail every one week automatically.





Wordpress

Related
Gravity Forms - Populate Checkbox in Form from Multiple Single Line Text Input Answers from User - Wordpress Solution Gravity Forms - Populate Checkbox in Form from Multiple Single Line Text Input Answers from User - Wordpress Solution
Force DIV refresh upon coupon X application / removal - Wordpress Solution Force DIV refresh upon coupon X application / removal - Wordpress Solution
looking for a good way to query posts on a list of specific days. tryi - Wordpress Solution looking for a good way to query posts on a list of specific days. tryi - Wordpress Solution
Custom SQL Query? - Wordpress Solution Custom SQL Query? - Wordpress Solution
Plugin User Role Level Error - Wordpress Solution Plugin User Role Level Error - Wordpress Solution

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10