13 votes

WordPress AJAX File Upload - FrontEnd

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" ...
user avatar
10 votes

How to use nonce with front end submission form?

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 ...
user avatar
10 votes
Accepted

How to display TinyMCE without wp_editor()

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( ...
user avatar
  • 1,140
8 votes

How to use nonce with front end submission form?

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) ...
user avatar
8 votes

Redirect user using the 'wp_login_failed' action hook if the error is 'empty_username' or 'empty_password'

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 ...
user avatar
  • 181
8 votes

How do I fetch the static front page using the REST API?

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\...
user avatar
  • 64.1k
8 votes
Accepted

Why are my frontend theme styles bleeding into the backend?

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 ...
user avatar
  • 52.5k
7 votes
Accepted

Redirect users after first login

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 ) { /...
user avatar
  • 3,144
6 votes

Deleting users from front-end with wp_delete_user()

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 ...
user avatar
6 votes
Accepted

Update user meta using with ajax

Alright, there's a few things that isn't standardized WordPress so I've put together a minimal script which I'll explain piece by piece. Hopefully clear things up for you by the time you get to the ...
user avatar
  • 19.6k
6 votes

Is there any filter to disable the total fronted in WordPress

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(){ ...
user avatar
  • 14.7k
5 votes

is_admin() returns true when using admin-ajax.php from front end script

is_admin() always returns true for every AJAX call. If you want to validate AJAX calls from frontend only, this may be a work-around: if (!isset($GLOBALS['current_screen']) && !...
user avatar
  • 3,359
5 votes
Accepted

Is it Possible to Extend WP Customize JS Methods?

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 ...
user avatar
  • 16.7k
5 votes

Way to display media library in frontend

As far I've understood with those I've written a simple system for you. Please put the below codes in your functions.php- add_action( 'wp_enqueue_scripts', 'the_dramatist_enqueue_scripts' ); ...
user avatar
  • 4,357
5 votes
Accepted

Create and move terms for taxonomies

wp_update_term() doesn't changes taxonomy. It just updated the existing taxonomy. Say the below code- $update = wp_update_term( 1, 'category', array( 'name' => 'Uncategorized Renamed', '...
user avatar
  • 4,357
4 votes

Disable front end to use as CMS only?

Although this is a rather old question with an already accepted answer, someone might find this useful, specially since none of these solutions worked for me. function redirect_to_backend() { if( ...
user avatar
  • 176
4 votes

wp_enqueue_scripts hook is not being called

For anyone getting this problem in an admin page, use the admin_enqueue_scripts hook instead of the wp_enqueue_scripts hook. Documentation here.
user avatar
4 votes
Accepted

ajax call in wordpress front end

You have to localize script by using wp_localize_script function. In the admin side ajaxurl is already available. But in front end you have to localize script to define ajaxurl. Example: ...
user avatar
4 votes
Accepted

There's an image named g.gif somewhere in my WordPress site

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
user avatar
  • 52.5k
4 votes
Accepted

How can I trash multiple posts at once from the front end?

It should be action instead of "doaction", then it will work just fine. As for your request for some documentation, as far as I know there is no overview about parameters/actions available at edit....
user avatar
4 votes

Using WordPress only for the backend, and using AngularJS as a frontend

Note: I am posting an answer to my own question with hopes of it being useful for developers trying to solve the same problem that my initial query proposes. As it turns out, I was viewing this with ...
user avatar
  • 161
4 votes

How to Layer 7 Load Balance WordPress Backend and Frontend?

The problem #1 & #2: Don't know why you need to add and validate extra cookies, but for me, it's simple and quite straight forward: This is what I have tried on vagrant boxes and with default ...
user avatar
  • 3,359
4 votes
Accepted

WP Admin Bar frontend issue with dashicon deregister

Well, the dashicons are used in the admin bar, so if you deregister them, your admin bar is broken. The easy way out is only to deregister the icons if there is no admin bar: add_action( '...
user avatar
  • 13.8k
4 votes
Accepted

Insert wp_editor on front-end with AJAX?

So, after doing some more digging, I answered my own question by "connecting the dots", so to speak. There's a lot of bits and pieces of info on this topic on StackOverflow and StackExchange, but none ...
user avatar
  • 1,264
4 votes
Accepted

Is it secure to use admin-ajax.php in front?

I would like to know if it is secure to use admin-ajax.php for your ajax requests on the front. There is nothing fundamentally insecure about using it for AJAX requests as a protocol. So is it ...
user avatar
  • 52.5k
4 votes
Accepted

Fullscreen Video/GIF Intro

The following code uses HTML5 Video, with the muted & autoplay attributes set. It takes the video, which I uploaded through the media gallery and displays it fullscreen. I'm using a script that ...
user avatar
  • 3,611
4 votes

How To Import CPT With Only Few TEXT ACF Fields From Front End?

I'm not quite sure if there are any plugins that work out of the box the way you describe. You might want to do some research on the many importing plugins published for WordPress to see, if any of ...
user avatar
4 votes
Accepted

Frontend Post - Allow Only Image File Upload

You can check mime type of uploaded image before upload to media. Add mimeTypes in $allowmimeType which you want to allow. then check uploaded files mimetype $fileMimeType. If not found in allowed ...
user avatar
3 votes

upload featured image from front end using wordpress add media button

add below code after echo $attach_id.... set_post_thumbnail( $post_id , $attach_id);
user avatar
  • 377
3 votes

Are there any action like 'init_frontend'

Late to the party, but found the other answers not quite as clear. There is no init-like hook that is front-end only. admin_init only runs in the dashboard. init runs on both the front-end as well ...
user avatar

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