• Resolved Matt Cromwell

    (@webdevmattcrom)


    I have a custom meta field that holds an HTML transcript per post. I need to have the contents of that html file included in the JSON export. I’m trying to use the PHP function readfile() for that purpose but not having luck. Also tried echo readfile

    Thank you for any guidance you have. Thanks for a really useful and robust free plugin for the WP community!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Matt Cromwell

    (@webdevmattcrom)

    I’ve also tried creating a helper function for this.

    function wppt_transcript_export($value) {
    // Check if the file exists and is readable
    if (file_exists($value) && is_readable($value)) {
    // Output the contents of the file
    return file_get_contents($value);
    } else {
    // Handle the case where the file doesn't exist
    return "File not found or not readable.";
    }
    }

    But it always returns “File not found…” even though every episode has an associated file.

    Thread Starter Matt Cromwell

    (@webdevmattcrom)

    OK, I simplified this a ton and just used:

    file_get_contents

    And it worked great. Solve it by rubber-ducking it with you. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.