Hrohh
Forum Replies Created
-
Forum: Plugins
In reply to: [System Dashboard] dangerous pluginHi, thank you for fast response. In fast-ajax.php ( https://github.com/atwellpub/WordPress-Fast-Ajax-Mu-Plugin/blob/master/fast-ajax.php) there is no check for nonce. You should also check capability in ajax function, nonce is good, but if you call from admin, you should call current_user_can( ‘read’) at least. It is definitely dangerous like this. Also ensure that this file is deleted if your plugin is deactivated.
Autoload check – look in function wp_load_alloptions() , there is multiple values “yes”, “auto”, “auto-on” etc.
wp_cache_delete( ‘alloptions’, ‘options’ );
timer_start();
$alloptions = wp_load_alloptions();
$time = timer_stop( false, 5 );
$size = size_format( strlen( serialize( $alloptions ) ) );
printf( __( ‘Loading autoload options took %s seconds and used %s of memory.’ ), $time, $size );also instead of php copy() you should use $wp_filesystem->copy
Thanks
Forum: Plugins
In reply to: [Display All Image Sizes] wrong CSSwe can fix this
add_action( 'admin_head', 'core_plugin_display_all_image_sizes_admin_head' );
function core_plugin_display_all_image_sizes_admin_head() {
?>
<style>
html:has(#display-all-image-sizes-css) .compat-attachment-fields .label {
width: 100%;
}
</style>
<?php
}- This reply was modified 8 months, 3 weeks ago by Hrohh.
Forum: Plugins
In reply to: [Loco Translate] Bug in role TranslatorHi sir,
Ok it is your plugin, but I dont get it this logic…
Thank you for you support and work, great plugin!Dear Ashok,
thank you for you reply. Yes I know, but this format is standardized. Im developer itself, creating mu-plugin, reporting bugs to WP core team, patching, so sorry, but I dont have money for you plugin.
Have a nice day.
Thank you sir!👍
Hi sir, please look at this :/
Thank you!
Metadata over wp_get_attachment_metadata
Here sir
https://github.com/WordPress/performance/issues/1417#issuecomment-2265517786
After squeeze there is no “sources” array.Thank you.
- This reply was modified 1 year, 8 months ago by Hrohh.
Hi, now I found issue with metadata. In you code is
wp_create_image_subsizes() which will overwrite complete metadata of attachment. If some plugin interact with metadata field (many plugins do this), your plugin will replace after “Squeeze”. Maybe you can use func https://developer.ww.wp.xz.cn/reference/functions/_wp_make_subsizes/ OR save current metadata and after wp_create_image_subsizes() merge two arrays.So Modern Image Formats isnt compatible, because plugin saves source array with avif/webp formats in metadata. Thank you
I just tested plugin and check files on md5. So it is working ok, avif is created before “squeeze”. Only problem would be recrop by some plugin like “Crop Thumbnails”, it should recrop by original .bak file. I contacted author of plugin. Thank you.
Please look at it. I think in future, Modern Image Format would be merged with core WP.
Hi, please look at this.
Forum: Plugins
In reply to: [Anything Order by Terms] help with query with operator “EXISTS”$example = new WP_Query( array( 'post_type' => 'procedure', 'posts_per_page' => -1, 'post_status' => array( 'publish' ), 'orderby' => 'procedure_category', 'tax_query' => array( array( 'taxonomy' => 'procedure_category', 'operator' => 'EXISTS', ) ) ) ); in mu-plugins function core_order_by_taxonomy_get_taxonomy( $wp_query ) { if ( !isset( $wp_query->query_vars['orderby'] ) ) return false; $orderby = explode( ' ', (string)$wp_query->query_vars['orderby'] ); foreach( get_taxonomies() as $tax ) { if ( in_array( $tax, $orderby ) ) return $tax; } return false; } add_filter( 'posts_clauses', 'core_order_by_taxonomy', PHP_INT_MAX, 2); function core_order_by_taxonomy( $clauses, $wp_query ) { global $wpdb; $taxonomy = core_order_by_taxonomy_get_taxonomy( $wp_query ); if ( !$taxonomy ) return $clauses; $clauses['fields'] .= ', CAST(term_order_meta.meta_value AS UNSIGNED) AS term_order_int'; $clauses['join'] .= <<<SQL LEFT OUTER JOIN {$wpdb->term_relationships} AS term_order_rel ON {$wpdb->posts}.ID = term_order_rel.object_id LEFT OUTER JOIN {$wpdb->term_taxonomy} AS term_order_tax ON term_order_tax.term_id = term_order_rel.term_taxonomy_id LEFT OUTER JOIN {$wpdb->terms} AS term_order_terms ON term_order_terms.term_id = term_order_tax.term_id LEFT OUTER JOIN {$wpdb->termmeta} AS term_order_meta ON (term_order_meta.term_id = term_order_terms.term_id AND term_order_meta.meta_key = '_order_{$taxonomy}' ) SQL; $clauses['where'] .= " AND taxonomy = '{$taxonomy}'"; $clauses['groupby'] = "term_order_rel.object_id"; $clauses['orderby'] = trim( "COALESCE(term_order_int, ~0) ASC, " . $clauses['orderby'], ','); return $clauses; } add_filter( 'the_posts', 'core_order_by_taxonomy_final', 10, 2 ); function core_order_by_taxonomy_final( $posts, $wp_query ) { $taxonomy = core_order_by_taxonomy_get_taxonomy( $wp_query ); if ( !$taxonomy ) return $posts; $order_posts = array(); foreach( $posts as $post ) { $terms = get_the_terms( $post, $taxonomy ); foreach( $terms as $term ) { $order = get_post_meta( $post->ID, '_order_' . $term->slug, true ); if ( empty( $order ) ) $order = PHP_INT_MAX; $order_posts[ $term->slug ][] = array( 'order' => $order, 'post' => $post ); } } $posts = array(); foreach( $order_posts as $term => $val ) { usort( $val, fn($a, $b) => $a['order'] <=> $b['order'] ); $order_posts[ $term ] = $val; } foreach( $order_posts as $term => $val ) { foreach( $val as $p ) { $posts[] = $p['post']; } } return $posts; }