Create a user by coding in functions.php:
We can create a user by php code. These code should be written inside functions.php file to create a admin user.
$newUser = new WP_User('userName', 'pass', 'email');
$newUser->set_role('administrator');
This will create a user when the theme will be activated. Admin of the site wont be able to delete this user as long as the theme is active. For deletion, the theme must be deactivated first (i.e. making any other theme active).
Anyway, if the theme activated again, the userName will be created again.
Getting category of a post inside while loop:
the following code gives only first category (one post might have more than one category).
<?php echo get_the_category($postID)[0]->name; ?>
to get all the category by space separated string:
<?php
foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';
}
?>
Getting tags of a post:
1st param is what to put before starting, 2nd one is what is separator between two tags/items, 3rd id what to put at the end.
the_tags ( string $before = null, string $sep = ', ', string $after = '' )