Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged


Rather than hooking into init or wp_load, here is a snippet you can drop into functions.php or on a theme file. I put it behind a $_GET so that you can only hit it once and when you are ready. Something like // Hide it from the public if(isset($_GET['update_post_meta'])){ // Let's query all of the product ...


The block editor is restoring back the title that was last saved (or typed manually into the textarea), so with the block editor, you can change the title dynamically using this code: 'core/editor' ).editPost( { title: 'Title here' } ) PS: You should make sure your JS file has the wp-editor, wp-edit-post or wp-data as part of the ...


You can use it that way : function add_suffix_to_title($title, $id = null){ if (! is_admin()) { return '<h1>'.$title.'</h1> Your Suffix'; } return $title; } add_action( 'the_title', 'add_suffix_to_title', 10, 1 ); And when you invoke the "the_title" function remove the h1 tag : the_title(); I hope that would help you.


Please try this the_title( '<h1 class="entry-title">', 'YOUR CUSTOM CONTENT</h1>' );


Can't give you fish, but I can try you to teach how to fish with a couple of pointers; hook into publish_post (good example code there) and / or post_updated in the function that is called that way, use wp_create_category (which will only create if the cat. name doesn't exist yet) and with the cat ID you get that you then call wp_set_post_categories (make ...


There are times when you cannot do this from functions.php (you don't have the data you want to output yet). For these cases: make a new copied header file header-mycustom.php and load it in your template global $newtitle; $newtitle="New Title"; get_header("mycustom"); in the header-mycustom.php replace wp_head with the following: <?php ob_start(); ...

Top 50 recent answers are included