add menu page in loop menu order

Ok it took me a while, but I think I have it. I had to use usort. I also included the code for the get_top_level_pages() method. $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array(‘post_type’ => ‘page’, ‘posts_per_page’ => ‘-1’)); $top_level_pages = get_page_by_title(‘Locations’); $menuArray = get_page_children( $top_level_pages->ID, $all_wp_pages ); function compareOrder($a, $b) { return $a->menu_order – $b->menu_order; … Read more

My plugin showing “Are you sure you want to do this” on screen with a “Argument #2 is not an array in load.php’

It appears that the issue is related to my uses of this code: $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING) ; $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING) ; I had placed this at the top of the plugin (outside of the plugin’s class); I used it to sanitize any GET and POST values. When you do any action (like a … Read more

Update database record in plugin

It’s really hard to understand what are you actually doing ( a refactor will help also). but for updating you can try: You will need the $id, show you tell which row to update. $wpdb->update( $wpdb->prefix . ‘tropix_dmin’, array( ‘post_name1’ => $arr), array( ‘id’ => $id ), array( ‘%s’ ), array( ‘%d’ ) );

Custom recurrence not working / Wp Cron event

Maybe someone will make use of it, I had a similar problem and the solution was to call time() instead of current_time( ‘timestamp’ ) as the first argument of wp_schedule_event(). So it should look like this: wp_schedule_event( time(), ‘custom_interval’, ‘custom_hook’ ); I tried to find a difference between time and current_time(‘timestamp’), but they appear to … Read more