Title: Default for second title possible?
Last modified: July 24, 2019

---

# Default for second title possible?

 *  Resolved [iriteser](https://wordpress.org/support/users/iriteser/)
 * (@iriteser)
 * [7 years ago](https://wordpress.org/support/topic/default-for-second-title-possible/)
 * Hi Kolja
 * thanks for this VERY helpful plugin!
 * I want to use it to add the (in Germany mostly necessary) “[Werbung]” (advertisment)
   to my posts.
 * Question: I have round about 3000 blog posts. Is it possible to set a default
   value so all are changed in once?
 * Thanks in advance
    Irit
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdefault-for-second-title-possible%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [iriteser](https://wordpress.org/support/users/iriteser/)
 * (@iriteser)
 * [7 years ago](https://wordpress.org/support/topic/default-for-second-title-possible/#post-11762909)
 * oh, second question: how to manage the subtitle in a new line?
 *  Plugin Author [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * (@thaikolja)
 * [7 years ago](https://wordpress.org/support/topic/default-for-second-title-possible/#post-11789788)
 * Hi [@iriteser](https://wordpress.org/support/users/iriteser/),
 * Please excuse the late reply.
 * > how to manage the subtitle in a new line?
 * You can do this by adding `<br>` to the title format.
 * > Question: I have round about 3000 blog posts. Is it possible to set a default
   > value so all are changed in once?
 * Not by default, but you could loop through all posts and then set it programmatically.
   Here’s an example:
 *     ```
       <?php
       /** Array to store updated posts for results */
       $updated = [];
   
       /** Get all posts */
       $posts = get_posts(
       	[
       		"post_type" => "post", // The post type you'd like to change
       		"showposts" => -1 // To loop through ALL posts
       	]
       );
   
       /** Only run if Secondary Title is active */
       if(function_exists("get_secondary_title")) {
       	/** Loop through all posts */
       	foreach($posts as $post) {
       		$secondary_title = get_secondary_title($post->ID);
   
       		/** Skip this post if it already has a secondary title (and is longer than 3 characters) */
       		if(strlen($secondary_title) >= 3) {
       			continue;
       			/** Add // before "continue" if you want to disable the skipping */
       		}
   
       		$updated[] = update_post_meta(
       			$post->ID,
       			"_secondary_title",
       			"[Werbung] "
       		);
       	}
   
       	/** Display results */
       	echo count($updated) . " posts have been updated.";
       }
       ```
   
 * I didn’t test this. **Do not run this code snippet without adjusting it to your
   needs and don’t forget to make a database backup before.**
    -  This reply was modified 7 years ago by [thaikolja](https://wordpress.org/support/users/thaikolja/).
 *  Thread Starter [iriteser](https://wordpress.org/support/users/iriteser/)
 * (@iriteser)
 * [7 years ago](https://wordpress.org/support/topic/default-for-second-title-possible/#post-11821015)
 * Hi Kolja
 * thanks very much for your answers! I will play around with your code. And of 
   course I make an backup before 😉
 * LG Irit

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Default for second title possible?’ is closed to new replies.

 * ![](https://ps.w.org/secondary-title/assets/icon.svg?rev=2520363)
 * [Secondary Title](https://wordpress.org/plugins/secondary-title/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/secondary-title/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/secondary-title/)
 * [Active Topics](https://wordpress.org/support/plugin/secondary-title/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/secondary-title/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/secondary-title/reviews/)

## Tags

 * [default value](https://wordpress.org/support/topic-tag/default-value/)

 * 3 replies
 * 2 participants
 * Last reply from: [iriteser](https://wordpress.org/support/users/iriteser/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/default-for-second-title-possible/#post-11821015)
 * Status: resolved