Image Search Not Working

Image search functionality in DigiBlocks allows you to search and insert high-quality images directly from supported providers within the Image block. If this feature isn’t working properly, there are several potential causes and solutions to explore.

Understanding Image Search Requirements

Image search in DigiBlocks requires proper configuration of an image API provider. The plugin supports three providers:

  • Unsplash – Free tier: 50 requests/hour
  • Pexels – Free tier: 200 requests/hour
  • Pixabay – Free tier: 5,000 requests/hour

Common Causes and Solutions

Provider Not Configured

The most common reason image search doesn’t work is that no image API provider has been configured or the configuration is incomplete.

Solution:

  1. Navigate to DigiBlocks > Settings
  2. Scroll to the Image API Settings section
  3. Select an image provider from the dropdown
  4. Enter the required credentials for your chosen provider
  5. Save the settings

Missing or Invalid API Credentials

Each provider requires specific credentials that must be obtained from their respective developer portals.

For Unsplash:

  • Application ID (optional)
  • Access Key (required)
  • Secret Key (optional, for advanced features)

Get credentials from: https://unsplash.com/developers

For Pexels:

  • API Key (required)

Get credentials from: https://www.pexels.com/api/

For Pixabay:

  • API Key (required)

Get credentials from: https://pixabay.com/api/docs/

Browser Console Errors

Check your browser’s developer console for JavaScript errors that might prevent the image search from functioning.

Solution:

  1. Open your browser’s developer tools (F12)
  2. Go to the Console tab
  3. Try using the image search feature
  4. Look for any error messages
  5. Common errors include network issues, authentication failures, or API rate limit exceeded

Network and Firewall Issues

Your server might be blocking outbound requests to the image provider APIs.

Solution:

  1. Contact your hosting provider to ensure outbound HTTPS requests are allowed
  2. Check if your server’s firewall blocks requests to:
    • api.unsplash.com (for Unsplash)
    • api.pexels.com (for Pexels)
    • pixabay.com (for Pixabay)

WordPress REST API Issues

Image search functionality relies on WordPress REST API endpoints. If these are disabled or restricted, the feature won’t work.

Solution:

  1. Ensure WordPress REST API is enabled
  2. Check if any security plugins are blocking REST API requests
  3. Verify that the user has proper permissions to access the API

Plugin Conflicts

Other plugins might interfere with the image search functionality.

Solution:

  1. Temporarily deactivate all other plugins
  2. Test the image search feature
  3. If it works, reactivate plugins one by one to identify the conflicting plugin
  4. Contact the conflicting plugin’s support or DigiBlocks support for compatibility solutions

Server PHP Configuration

Certain PHP configurations might prevent the image search from working properly.

Solution:

  1. Ensure your server has the curl extension enabled
  2. Check that allow_url_fopen is enabled in PHP configuration
  3. Verify that your server can make outbound HTTPS requests
  4. Ensure adequate memory limits for processing API responses

Rate Limit Exceeded

If you’ve exceeded your API provider’s rate limits, image search will temporarily stop working.

Solution:

  1. Check your usage against your provider’s limits
  2. Wait for the rate limit to reset (usually hourly)
  3. Consider upgrading to a paid plan with higher limits
  4. Implement caching strategies to reduce API calls

Outdated Browser or JavaScript Disabled

The image search feature requires modern JavaScript functionality.

Solution:

  1. Ensure JavaScript is enabled in your browser
  2. Update to a modern browser version
  3. Clear browser cache and cookies
  4. Try using a different browser to isolate the issue

Provider-Specific Issues

Unsplash Issues

  • Invalid Application ID: While optional, if provided, it must be valid
  • Access Key Format: Ensure the access key is copied correctly without extra spaces
  • Secret Key: Only needed for advanced features; can be left empty for basic functionality

Pexels Issues

  • API Key Validation: Pexels validates API keys strictly; ensure it’s active and valid
  • Request Format: Pexels has specific requirements for search queries

Pixabay Issues

  • Account Verification: Ensure your Pixabay account is verified
  • API Key Status: Check that your API key is active in your Pixabay account settings

Testing the Configuration

After configuring your image provider:

  1. Edit a page or post
  2. Add an Image block
  3. Look for the image search functionality within the block
  4. Try searching for a common term like “nature” or “business”
  5. Check if results appear and images can be inserted

Alternative Solutions

If image search continues not to work:

  1. Use a different provider: Switch to another supported image provider
  2. Manual image upload: Continue using the standard WordPress media library
  3. Browser-based search: Search for images manually on the provider’s website and download them for upload

Getting Additional Help

If none of these solutions resolve your image search issues:

  1. Check the browser console for specific error messages
  2. Verify your server meets all technical requirements
  3. Ensure your chosen provider’s service is operational
  4. Contact your hosting provider about potential server-side restrictions

The image search feature enhances your workflow by providing access to high-quality stock images directly within the WordPress editor, but it requires proper configuration and a stable connection to external API services.