Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4322344
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:51:41+00:00 2026-05-21T08:51:41+00:00

In the script below, I’m getting an invalid arguments error on the echo implode()

  • 0

In the script below, I’m getting an invalid arguments error on the “echo implode()” line:

Warning: implode() [function.implode]:
Invalid arguments passed in…

Here is the script:

if ( !function_exists('wp_tag_cloud') || get_option('cb2_noposttags')) return;
$unlinkTags = get_option('cb2_unlinkTags'); 
echo '<div class="links"><h2>Tags</h2>';
if($unlinkTags)
{
        $tags = get_tags();
        foreach ($tags as $tag){
            $ret[]= $tag->name;
        }
        echo implode(', ', $ret);
}
else
{
    wp_tag_cloud('separator=, &smallest=11&largest=11');
}
echo '</div>';

How might I rework this to catch the invalid argument?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:51:42+00:00Added an answer on May 21, 2026 at 8:51 am

    Initialise $ret as an array before your foreach loop.

    $ret = array();
    $tags = get_tags();
    foreach ($tags as $tag){
       $ret[]= $tag->name; 
    } 
    echo implode(', ', $ret); 
    

    Then, if get_tags() doesn’t return anything, $ret is still being passed into implode as an array (but as an empty array) rather than as a null

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Script below is not working. Not getting any php error messages. Had asked a
I'm using this script below for loading a hidden div, inside another: $(document).ready(function(){ $(function()
My script below generates a url if the $.post() response has an error. I
Why does the script below come up with the following error? Add-Member : Cannot
I have a powershell script (below) which seems to work but prints an error
In the script below, when there is a sql error, %errorlevel% is 0 -
the script below doesn't seem to work! what's wrong with it? here is what
I've written the Perl script below which generates a warning and I can't work
The script below works as far as i can tell: <script type=text/javascript language=javascript> $(document).ready(function()
update: when I echo $res in the script below, I get the following, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.