How to update the children of a post?

get_children returns an array of post objects by default: https://developer.wordpress.org/reference/functions/get_children/ So you would have to use ‘ID’ => $child->ID, in this case… also my want to wrap the foreach with if (count($children) > 0) {} to prevent possible errors where there are no children. ie: $children = get_children( $mainid ); if (count($children) > 0) { … Read more

Front-end registration form with password field

If you were to use a plugin that uses shortcode you can call it in your template by using this in your template: <?php echo do_shortcode (‘[your-shortcode]’); ?> You can also do something similar to this form / code below for a front end login: <form method=”post” action=”<?php bloginfo(‘url’) ?>/wp-login.php” class=”wp-user-form”> <div class=”username”> <label for=”user_login”><?php … Read more

Front end posting

You can not use wp_redirect() if the headers have already been sent so snippet you provided should not be used within your template files, instead you should wrap it within a function and place it into your functions.php file and hook onto template_redirect action. Example: add_action(‘template_redirect’, ‘front_end_post’, 99); function front_end_post() { if( ‘POST’ == $_SERVER[‘REQUEST_METHOD’] … Read more

How to add correct Last update in Postings (the_modified_time)

You could compare post_date to post_modified and only echo your content if they do not match. // inside a Loop if ($post->post_date != $post->post_modified) { ?> <span style=”font-size:85%”>Last update <u><time datetime=”<?php the_modified_time(‘d-m-y’); ?>”> <?php the_modified_time(‘l j F, Y’); ?></time></u></span><?php } If you want “significant” updates, though, you will need to determine what counts as significant … Read more

select box not checked and is not saved

In the code documentation: // TEMPLATE ACTION TAG TO BE USED IN THEME // Usage: do_action(‘wpse_crowd_cats_form’); // Usage: do_action(‘wpse_crowd_cats_form’, $post_id, $taxonomy ); If the do_action is going to be placed in the loop, then do_action(‘wpse_crowd_cats_form’, get_the_ID()); should work.