0815

Du musst dich anmelden um Beiträge und Themen zu erstellen. Einloggen · Registrieren

Automatically Insert Content into Your WordPress Post Editor

Here is a nice way to automatically insert some custom content into your post editor. This makes it easy to add repetitive content to your posts while retaining the ability to make changes before publishing. To try it out, add the following code to your functions.php file:

<?php // auto-insert content to post editor
function my_editor_content($content) {
	$content = "<h5>Thank you for your generous attention!</h5>.";
	return $content;
}
add_filter('default_content', 'my_editor_content');
?>

This code will display a message thanking people for their generous attention, but you can easily edit the message to display whatever content (text/markup) that you wish. After configuring your message, open your WordPress text editor to see the automatically inserted content.




0