Creating wordpress user registration form

You are sending the data from the form directly to TestForm.php file, which is a PHP script outside of WordPress logic. It is and independent script. You could set the form’s action attribute to a empty string, this way the form data is sent to same page that contains the form, which is part of … Read more

Most elegant way to enqueue scripts in function.php with foreach loop

You need to enqueue the scripts as well, not only register them. You can, however, just simply enqueue a script without registering it if you are not going to enqueue it conditionally. I would try something like this: (Untested and requires PHP5.4+) add_action( ‘wp_enqueue_scripts’, enqueue_scripts, 11 ); function enqueue_scripts() { /** * Build an array … Read more

Allow authors to post only in categories they create in WordPress

This little plugin shows the user role ‘author’ only its own categories & posts. So you can edit it for your own post-type and taxonomy. /* Plugin Name: Show own categories Description: This plugin shows the user role ‘author’ only its own categories & posts Version: 0.1 Author: Soren Wrede License: GPL2 License URI: https://www.gnu.org/licenses/gpl-2.0.html … Read more

Adding New Role

Happened to me first time. Not a matter at all. If you want how this thing works and how to debug it, read on. But if you want to hear the cause what just happened, go to the very bottom of this answer (#Specific Answer). If you contact the Codex page for add_role(), the second … Read more

how to create shortcode in wordpress

You can create your short code just few steps. function short_codeFunction_name( $atts, $content=null ) { shortcode_atts( array(), $atts); $rowin = ‘<div class=”row”>’.do_shortcode( $content ) .'</div>’; return $rowin; } add_shortcode( “your_shortcode_name”, “short_codeFunction_name” ); Then you can access [your_shortcode]Here your content[your_shortcode] format inside the Post,page etc. add this function inside function.php in active theme directory. use inside … Read more

How to override WordPress registration and insert an auto-generated username?

One alternative is to modify the $_POST[‘user_login’] input value when submitting new registration form, that is before WP process the registration form. A good hook to achieve this is login_form_register that fires before processing and rendering registration form. login_init also works but need more work to make sure we are on register action. add_action(‘login_form_register’, ‘custom_user_login’); … Read more