I'm getting this PHP error in my custom breadcrumb function:
Warning: sprintf(): Too few arguments in /srv/bindings/56058a57d7424f84adac37ba6b03d3b7/code/wp-content/themes/inspire-spine/functions.php on line 151
Here is the code:
if ( is_page() && $parent_id ) {
if ($parent_id != $frontpage_id) {
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
if ($parent_id != $frontpage_id) {
$breadcrumbs[] = sprintf($link, get_permalink($page->ID)); //, get_the_title($page->ID));
}
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
for ($i = 0; $i < count($breadcrumbs); $i++) {
echo $breadcrumbs[$i];
if ($i != count($breadcrumbs)-1) echo $delimiter;
}
}
if ($show_current == 1) {
if ($show_home_link == 1 || ($parent_id_2 != 0 && $parent_id_2 != $frontpage_id)) echo $delimiter;
echo $before . get_the_title() . $after;
}
}
I get the error in line 7, what am I missing?
in my case: for example:
use %65 in my string
sprintf seek every % and if counts of them is not equal to your parameters return this error
like this :
Your sprintf string has 2 placeholders, your filling one.
https://3v4l.org/nu8Ht