How to make temporary expiring link for a downloadable file

Option 1: You can achieve this using htaccess if you have single download file/path. But if you have more files available for download. Creating a temporary file for each download requests and using htaccess is not a good idea. $path=”uploads/”; $actualfilename=$path.$filename; $fakefilename=”downloadfile.pdf”; if($typeofview==”download”) { @readfile($actualfilename); header(‘Content-type: application/pdf’); header(‘Content-Disposition: attachment; filename=”‘ . $fakefilename . ‘”‘); header(‘Content-Transfer-Encoding: … Read more

‘Save settings’ (submit button) ISSET

You question is not well explained, what you want to achieve, here is the suggestion, you can add JS event ONClick into you submit button and define the JS function according to your goals, (for example you want to count submit button click) <script type=”text/javascript”> var clicks = 0; function onClick() { clicks += 1; … Read more

making a simple plugin

Welcome to Stackoverflow. I think First of all you need to learn How to Google search. After that you can start writing your plugin. Well Here is the WordPress Plugin Handbook https://developer.wordpress.org/plugins/. As it states The Plugin Developer Handbook is a resource for all things WordPress plugins. Whether you’re new to WordPress plugin development, or … Read more

WP Offload S3 Lite “Please setup GD or ImageMagick” noticed

Create a file called phpinfo.php in your DocumentRoot <?php phpinfo(); ?> Run it from the command line (php phpinfo.php), check for the gd section. If the gd section is missing, you didnt install gd. Now run the same file from the browser (http://domain.com/phpinfo.php) and again check the gd section. My guess is that the browser … Read more

How to display blog posts only authored by the administrator

Four changes to your script. Limit $users to users with ‘administrator’ role. Removed line if($user->caps[‘Administrator’]!=1) continue; as every user is an administrator. Changed ‘post_per_page’ to -1, to process all posts. Added wp_reset_postdata(); after each loop: $users = get_users( array( ‘role’ => ‘administrator’ ) ); foreach ( $users as $user ) { $query = new WP_Query( … Read more

How to do Conact form 7 name field validation? [closed]

According to the documentation you have to create a custom filter to support it – you can do it like this: add_filter( ‘wpcf7_validate_text*’, ‘custom_text_validation_filter’, 20, 2 ); function custom_text_validation_filter( $result, $tag ) { if ( ‘your-name’ == $tag->name ) { // matches any utf words with the first not starting with a number $re=”/^[^\p{N}][\p{L}]*/i”; if … Read more