Limit wp_nav_menu_objects() only to first-level menu items

depth argument, available in functions attached to wp_nav_menu_objects hook, refers to the max depth of rendered menu (how many menu levels will be visible on site). To change only first-level elements, you can check in the loop if the menu item has a parent. function change_menu($items) { if( !is_front_page() ) { foreach($items as $item) { … Read more

Set different max upload size limits based on file type/extension

This should work: function max_video_size( $file ) { $size = $file[‘size’]; $size = $size / 1024; $type = $file[‘type’]; $is_image = strpos( $type, ‘video’ ) !== false; $limit = 750; $limit_output=”750kb”; if ( $is_image && $size > $limit ) { $file[‘error’] = ‘Video files must be smaller than ‘ . $limit_output; } return $file; } … Read more

Limit blogs creation

The signup page has validation hooks. How about something like this? add_filter(‘wpmu_validate_blog_signup’,’set_blog_creation_limit’); function set_blog_creation_limit($result) { $blogs = get_blogs_of_user($result[‘user’]->ID); if (count($blogs) > 2 ) $result[‘errors’]->add(‘blogname’, __(‘You have already registered the maximum amount of blogs!’)); return $result; }

How to solve Woocommerce Memory Limit

You could also try toying with the max memory limit. I think it’s far more likely you are on an EIG host and throttled to a 64mb limit. Oh one more thing, it’s define( ‘WP_MEMORY_LIMIT’, ‘128M’ );

query post limits

The third parameter for add_filter is the priority in which the filter is executed, the forth is the number of parameters the function in the second parameter uses. The wpcodex_filter_main_search_post_limits function has an if that checks uses a couple of wordpress function to establish where in your page you are executing the code, in this … Read more

Defined WordPress Memory Limit to Unlimited

If you search WP source code, you’ll find _MEMORY_LIMIT in wp-includes/default-constants.php $current_limit = @ini_get( ‘memory_limit’ ); $current_limit_int = wp_convert_hr_to_bytes( $current_limit ); //.. if ( ! defined( ‘WP_MAX_MEMORY_LIMIT’ ) ) { if ( false === wp_is_ini_value_changeable( ‘memory_limit’ ) ) { define( ‘WP_MAX_MEMORY_LIMIT’, $current_limit ); } elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = … Read more

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