WordPress Recipe-Press plugin, ingredient page link select not displaying saved result

When implementing the Recipe-Press WordPress plugin for a client we came across an issue that the ingredient page link select did not display the saved result, and just defaulted to none.

Maybe this image will help

Hence even though the proper page link gets saved, it doesn’t show that selection on the form

 

 

 

 

 

The Solution:

1. Open YOUR-PLUGIN-DIRECTORY/recipe-press/includes/form_tags.php

2. Go to line 303 and find the following piece of code in function recipe_dropdown_pages :

 

303
304
305
306
307
308
309
310
foreach ( $post_type as $type ) {
$r = array(
'post_type' => $type,
'numberposts' => -1,
'selected' => null,
);
$results[$type] = get_posts($r);
}

 

3. Replace the above code with:

 

303
304
305
306
307
308
309
310
foreach ( $post_type as $type ) {
$r = array(
'post_type' => $type,
'numberposts' => -1,
'selected' => $selected,
);
$results[$type] = get_posts($r);
}

 

4. The result:

Leave a Reply

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