limit file type and file size using media_handle_upload

Use PHP // Check that the nonce is valid, and the user can edit this post. if (isset( $_POST[‘my_image_upload_nonce’] ) && wp_verify_nonce( $_POST[‘my_image_upload_nonce’], ‘my_image_upload’ ) ){ // Input type file name $image_input_name=”my_image_upload”; // Allowed image types $allowed_image_types = array(‘image/jpeg’,’image/png’); // Maximum size in bytes $max_image_size = 1000 * 1000; // 1 MB (approx) // Check … Read more

Show content from database

You could use custom post types and custom taxonomies. Using the custom post types to store data, taxonomies to categorize the data and you can utilize WordPress’ default searching functionality. https://codex.wordpress.org/Post_Types https://codex.wordpress.org/Taxonomies https://codex.wordpress.org/Creating_a_Search_Page

ACF: Only get first row of a Repeater Field

ACF has a function called get_row_index() that you can utilize. Here is how you can possibly use it in your case <?php $active=”active”; while ( have_rows(‘images’) ) : the_row(); $image = get_sub_field(‘image’); if(get_row_index() == ‘1’ ): ?> <img src=”<?php echo get_template_directory_uri(); ?>/files/images/<? php the_sub_field(‘image’); ?>” class=”img-fluid is-slider-item” /> break; <?php $active=””; endwhile; ?> <?php endif; … Read more

Register new user in the frontend

Yes, yes you can. The relevant functions to do this are: wp_create_user Creates a user given a user/pass/email wp_insert_user Creates or updates a user given user/pass/email add_user_meta Adds User Meta ( same as Post Meta/Custom fields but for users rather than posts ) You’ll find examples on how to use those functions, and links to … Read more

Help with AJAX front end comment moderation

Seems to me that the only problem is that you put the full approve url in the link, in this ways when you click the link you trigger the ajax and open the page url in the link. To be more clear your link is something like: <a class=”p3-comment-moderation” href=”https://wordpress.stackexchange.com/questions/128383/admin-ajax.php?action=p3_comment_approve&comment_id=123&nonce=xxxxx” data-comment_id=”123″ data-nonce=”xxxxx”>Approve</a> thanks to the … Read more

Disable or Enable Comments on Front end [closed]

Actually it’s there within WordPress by Default. If your WordPress editor is not showing it, then from the top left corner, click the Screen Options drop down menu. It’ll show some check boxes. Among those, there is one called Discussion. If you check that, then WordPress will show the option Allow Comments after the editor … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)