amarinediary / WordPress-simple-URL-based-breadcrumb

🍞 A non-invasive WordPress unofficial plugin, minimalist and SEO friendly. both lightweight and lightning fast, adding URL based breadcrumb support. Plug-and-play, with no required configuration.
https://stackoverflow.com/a/67453887/3645650
Creative Commons Zero v1.0 Universal
27 stars 5 forks source link

Can't get the plugin to work properly #8

Closed nikolailehbrink closed 2 years ago

nikolailehbrink commented 2 years ago

Hi there, first off, thanks for the lightweight Plugin. I would really love to use it, but on my local site it only displays a php error when inserting the following code in singular.php:

    <?php

    $ingredients = array(
        'separator' => '→',
    );

    the_bread($ingredients);
    ?>

The error:

Warning: Undefined array key "REQUEST_SCHEME" in /Users/example/Local Sites/site/app/public/wp-content/plugins/Where-Is-My-Bread-main/where-is-my-bread.php on line 124

1 | 16789109378.5403 | 368904 | {main}( ) | .../index.php:0
2 | 16789109378.5403 | 369216 | require( '/Users/example/Local Sites/site/app/public/wp-blog-header.php ) | .../index.php:17
3 | 16789109378.5403 | 11755136 | require_once( '/Users/example/Local Sites/site/app/public/wp-includes/template-loader.php ) | .../wp-blog-header.php:19
4 | 16789109378.5403 | 11779600 | include( '/Users/example/Local Sites/site/app/public/wp-content/themes/theme/singular.php ) | .../template-loader.php:106
5 | 16789109378.5403 | 11991768 | the_bread( ) | .../singular.php:10
6 | 16789109378.5403 | 11991768 | get_the_crumbs( ) | .../where-is-my-bread.php:200

What do I do wrong?

amarinediary commented 2 years ago

That's interesting. REQUEST_SCHEME is a native variable of Apache web server since its version 2.4. Naturally, if a variable is not set by the server, PHP will not include it in its global array $_SERVER. Looking more deeply into the subject, keep you updated.

amarinediary commented 2 years ago

The following will be deployed in 1.0.7. View the changelog.

In response to (2):

amarinediary commented 2 years ago

@nikolailehbrink I've published an update that should handle your case. Awaiting your feedback.

nikolailehbrink commented 2 years ago

HI, wow! That was fast! Thank you very much! It works fine and thanks for the lightweight plugin :)