11

Its Not has hard as you think it is :) Add the password fields to your form : password: <input type="password" name="pass1" style="width:250px; margin-bottom:3px;"><br /> repeat password: <input type="password" name="pass2" style="width:250px; margin-bottom:3px;"><br /> then in your if($_POST){ replace this line: $random_password ...


11

Hi You have Use this COde For WordPress front-end AJAX file upload tutorial Code Here is my code: In my template file example.php <form enctype="multipart/form-data"> <input type="text" name="support_title" class="support-title"> <input type="file" id="sortpicture" name="upload"> <input class="save-support" name="save_support" ...


10

Here is a basic solutions for updating a post/page. I added a quick demo of custom meta fields. This is pretty basic, but will point you in the direction of plugin-less editing of posts on the front-end. This isn't super flexible, but you can add whatever you need to it. Add this code into your loop: <form id="post" class="post-edit front-end-form" ...


10

If you are willing to pay for it, the Gravity Forms plugin allows you to create forms that map to your Custom Post Types (even regular post and page - types) as well as map to your custom fields. For those who aren't and who are willing to roll up their sleeves then you can create a front end form that posts data into any post type of your choosing quite ...


10

I just ran into this issue as well, the cause of this is that at 600 pixels wide the admin bar goes from being position:fixed to position:absolute; When fixed, it is locked to the top of the screen (top:0) When absolute it is locked to the top of the closest container that contains it. This is the html element by default, but if a parent is defined to have ...


9

I use Advanced Custom Fields for lots of front end post editing with meta boxes. ACF allows you to build lots of advanced meta box fields and adds them automatically to the back end post panel. But there is a front end function as well. This method is completely free. The only way it costs anything is if you want to use any of their more complex field type ...


9

If you don't need wp_editor in front-end, I think its OK. Here a little bit different option settings with your tinymce init. I use this without wp_editor in front-end. <script> jQuery( document ).ready( function( $ ) { tinymce.init( { mode : "exact", elements : 'pre-details', theme: "modern", skin: "lightgray", ...


8

WordPress handles login failed in two ways: If it is a bad credential, and both username and password have a value, then this action can be captured by wp_login_failed If both, or one, of the options are empty, then WordPress generates the error object as the first parameter in the authenticate filter; it does not open and wp_login_failed action captures ...


8

You're supposed to enqueue on the wp_enqueue_scripts event. Placing the function in functions.php and immediately running it, will make it run on all pages, including the admin area Here's an example from the devhub: /** * Proper way to enqueue scripts and styles. */ function wpdocs_theme_name_scripts() { wp_enqueue_style( 'style-name', ...


7

There are a few functions that come in handy here: unstick_post - Unstick a post stick_post - Stick a post is_sticky - Figure out if a post is sticky With those three in mind, all we need to do is stick them together with some admin menu bar glue. First off, let's wrap everything in a class for fun and profit. This class will have some constants that we'...


7

Use the following code inside just before tag on your front end code. wp_nonce_field('name_of_your_action', 'name_of_your_nonce_field'); The above code will generate two hidden inputs inside your form tag. Now you can verify your nonce in the backend where you will process your form. Use the following code to verify the nonce you just created above. if(...


7

You can combine add_action() and an is_admin() check: ! is_admin() and add_action( 'init', 'my_custom_callback' ); Now the callback function will run on front-end only.


7

you can do that by running the function set_post_thumbnail( $my_post_id, $thumbnail_id ); remember, you have to process and insert the image into the library first: $uploaddir = wp_upload_dir(); $file = $_FILES[ ... whatever you have in your POST data ... ]; $uploadfile = $uploaddir['path'] . '/' . basename( $file ); move_uploaded_file( $file , $...


7

We could implement our own endpoint: https://example.tld/wpse/v1/frontpage Here's a simple demo (PHP 5.4+): <?php /** * Plugin Name: WPSE - Static Frontpage Rest Endpoint */ namespace WPSE\RestAPI\Frontpage; \add_action( 'rest_api_init', function() { \register_rest_route( 'wpse/v1', '/frontpage/', [ 'methods' => 'GET', ...


6

Another option would be to set a 301 redirect for all the slideshow CPTs to redirect somewhere (like the home page). This would get picked up by Google, and also make sure no one accidentally gets on them function rkv_slideshow_redirect() { global $wp_query; // redirect from 'slideshow' CPT to home page if ( is_archive('CPT_NAME_HERE') || ...


6

There is no such action in the front end (in a theme) by default. Simply use a custom action like do_action( 'theme_notices' ); and hook into this one.


6

Here is my solution: add_filter('the_editor_content', "firmasite_tinymce_style"); function firmasite_tinymce_style($content) { add_editor_style('assets/css/custom.css'); // This is for front-end tinymce customization if ( ! is_admin() ) { global $editor_styles; $editor_styles = (array) $editor_styles; $stylesheet = (...


6

The WordPress function get_the_modified_author() will give you the author who last edited the current post. But if you want to list all the users that have edit the current post, you could try: function get_the_modified_authors_wpse_99226(){ global $wpdb; $authors = array(); $results = $wpdb->get_results( $wpdb->prepare("SELECT ...


6

A simple user meta row can handle that for you (the second issue), you can store the post id and the vote (up/down) in an array and that is just the same as post meta ex /** * update user vote per post * @param int $user_id * @param int $post_id * @param mixed $vote can be an integer 1 / -1 and can also be a string "up"/"down" * @return void */ ...


6

Use following code to achieve your requirement. //hook when user registers add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); function myplugin_registration_save( $user_id ) { // insert meta that user not logged in first time update_user_meta($user_id, 'prefix_first_login', '1'); } // hook when user logs in add_action('wp_login',...


6

By Killing WP on non-admin Pages The below code will determine whether you are on a front-end page or not, and kill WP if you are. add_action( 'init', 'my_function' ); function my_function(){ if ( ! is_admin() ) wp_die(); } Note that this might also affect AJAX requests ( untested ) so you might want to add wp_doing_ajax() to your conditional too. ...


5

The above answer has an error and an omission (not sure why it has 4 checks) 1) int_val not a WP function intval is a WP function 2) You need to include("./wp-admin/includes/user.php" ) to call wp_delete_user I wanted to delete users without going to admin dashboard - Here is working code solution: add_action('init','prefix_delete_user'); function ...


5

The easiest way would be to use something like Ninja Forms with the following paid extension: http://wpninjas.com/downloads/front-end-posting/ You could also code this yourself. Essentially you'll create a form, and then use wp_insert_post() to create a full post. A sample form: <form action="" id="primaryPostForm" method="POST"> <fieldset&...


5

Use esc_url( $url ) for URLs that should be displayed and esc_url_raw( $url ) if the URL should be sent to the database. The first will replace bare ampersands & with &#038;. The second is a wrapper for the first; it will just suppress the escaping of ampersands. Both functions will check the protocol. See wp_allowed_protocols() for the list: 'http',...


5

I think setting 'publicly_queryable' => false should solve your problem!


5

I will enhance my small comment on your question. But again the hint; I'm not a JS expert. The follow source, hints was only used on playing with the Customizer for different checks, examples, like my sandbox. wp.customize Understanding the WP theme customizer interface centers around understanding the wp.customize javascript object. The wp.customize ...


5

That's the Jetpack Stats image, it's necessary to track the stats. You can disable it by disabling Jetpack Stats but it shouldn't be full width, that will be a CSS problem


4

To add a nonce to a form you can use the following function: wp_nonce_field($action, $name, $referer, $echo) $action = (optional) this is a string which represents the action name $name = (optional) this is a string which represents the name of the nonce. If you leave this field blank WordPress will default to “_wpnonce” Example: Frontend: <form ...


4

I think this small source code is your solution. It currently doesn't have frontend feedback for the Sticky Post change, but you can enhance this string, class or whatever you want in the function fb_stick_post. The first function adds the item in the Admin Bar and creates a new Url with a param value. Also, on click calls a function to read the Url param ...


4

It's much simpler than you think. The function you will be dealing with is wp_insert_term as I am assuming you only want to provide basic functionality to add a new term (club) and not update terms I won't cover the wp_update_term function now. The example below is very basic and is intended to be that way for brevity and clarity. You can essentially copy ...


Only top voted, non community-wiki answers of a minimum length are eligible