OpenDevelopmentMekong / wpckan

wpckan is a wordpress plugin that exposes a series of functionalities to bring content stored in CKAN to Wordpress' UI and also provide mechanisms for archiving content generated on Wordpress into a CKAN instance.
GNU General Public License v3.0
22 stars 14 forks source link

Fixing save Menu incompatibility in Wordpress 5.7.1 #374

Open exonianp opened 3 years ago

exonianp commented 3 years ago

When saving a menu a series of errors occurs (their number depends on the number of menu items):

Notice: Undefined index: post_type in /var/www/wordpress/wp-content/plugins/wpckan/wpckan.php on line 129

Notice: Undefined index: post_type in /var/www/wordpress/wp-content/plugins/wpckan/wpckan.php on line 129

Notice: Undefined index: post_type in /var/www/wordpress/wp-content/plugins/wpckan/wpckan.php on line 129

Notice: Undefined index: post_type in /var/www/wordpress/wp-content/plugins/wpckan/wpckan.php on line 129

To solve this issue you have to change in file

wp-content/plugins/wpckan/wpckan.php

Line 129 from:

if ( 'page' == $_POST['post_type'] ) {

to

if ( 'post.php' === $pagenow && isset($_GET['post']) && 'post' === get_post_type( $_GET['post'] ) ) {

as well as add in line underneath the definition of the function wpckan_edit_post (line 118) the following line:

_function wpckan_edit_post( $postID ) { global $pagenow;