Add Menu Order Property for Post Object

Code

Filename: gppa-add-menu-order-property.php

<?php
/**
 * Gravity Perks // GP Populate Anything // Add Menu Order Property for Post Object
 * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
 */
add_filter( 'gppa_object_type_properties_post', function( $props ) {
	global $wpdb;
	$props['menu_order'] = array(
		'label'    => esc_html__( 'Menu Order', 'gp-populate-anything' ),
		'value'    => 'menu_order',
		'callable' => array( gp_populate_anything()->get_object_type( 'post' ), 'get_col_rows' ),
		'args'     => array( $wpdb->posts, 'menu_order' ),
		'orderby'  => true,
	);
	return $props;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.