File Uploader – Upload without adding to Media Library

HTML Okay, you’ll of course want to set up an HTML file. I would use this code or something like it: <form action=”upload.php” method=”post” enctype=”multipart/form-data”> Select image to upload: <input type=”file” name=”fileToUpload” id=”fileToUpload”> <input type=”submit” value=”Upload Image” name=”submit”> </form> Of course, you don’t have to use upload.php as your filename, that’s just what w3schools used. … Read more

Use variable in SQL statement

Firstly, as a PHP rule, you don’t need to echo a variable when doing a string concatenation. Secondly, you need to prepare your query when adding a variable inside. So your query would become like this: $prepared = $wpdb->prepare( “SELECT meta_value FROM wp_woocommerce_order_itemmeta WHERE meta_key = ‘_wc_checkout_add_on_label’ AND order_item_id = %s”, $orderID ); $size = … Read more

‘pre_user_query’ interfering with user export

‘users’ != $current_screen->id in your file $current_screen is not set therefore, you are getting warning. You can pass custom var in your user query and check before running your code. $blogusers = get_users( ‘orderby=nicename&order=ASC&my_filter=1’ ); Here we are passing my_filter=1 then later we can check in pre_user_query global $wpdb, $current_screen; $vars = $user_search->query_vars; if (isset($current_screen->id) … Read more

How to edit the styles for the table of pages/post listed in the admin when you click on pages/posts?

I guess you are in edit.php so you can add style only for this admin page. function enqueue_my_scripts($hook) { if ( ‘edit.php’ != $hook ) { return; } //our script to remove fixed table class echo ‘<script>’; echo ‘$( “.wp-list-table” ).removeClass( “fixed” )’; echo ‘</script>’; } add_action( ‘admin_enqueue_scripts’, ‘enqueue_my_scripts’ ); The explanation is basic first … Read more

Foreach implode issue

Change it to: <?php $guiones = rwmb_meta( ‘mb_guionistas’, array( ‘multiple’ => true) ); $pieces = array(); foreach ($guiones as $item) { $pieces [] = ‘<a href=”‘ . get_bloginfo(‘url’) . ‘/?p=’ . $item . ‘” title=””>’ . get_the_title( $item ) . ‘</a>’; } echo implode(‘, ‘, $pieces); ?> bloginfo() echos values while get_bloginfo() returns values.