File manager - Edit - /home/proidvn/app.proid.vn/debug_vcf.php
Back
<?php /** * Debug script — run once to inspect VCF data for a specific post. * Usage: https://yoursite.com/debug_vcf.php?post_id=XXX * DELETE this file after debugging. */ define('ABSPATH', __DIR__ . '/'); require_once __DIR__ . '/wp-load.php'; $post_id = intval($_GET['post_id'] ?? 0); if (!$post_id) { die('Pass ?post_id=XXX'); } $avatar_space = get_post_meta($post_id, 'avatar 1', true); $avatar_nospace = get_post_meta($post_id, 'avatar1', true); $hide_vcf = get_post_meta($post_id, 'hide_permalink_vcf', true); echo "<pre>"; echo "post_id: $post_id\n"; echo "avatar 1 (with space): " . var_export($avatar_space, true) . "\n"; echo "avatar1 (no space): " . var_export($avatar_nospace, true) . "\n"; echo "hide_permalink_vcf: " . var_export($hide_vcf, true) . "\n\n"; // Test if the avatar URL is fetchable $avatar_val = $avatar_space ?: $avatar_nospace; if ($avatar_val) { if (filter_var($avatar_val, FILTER_VALIDATE_URL)) { echo "Avatar value is a URL: $avatar_val\n"; $response = wp_remote_get($avatar_val, ['timeout' => 10]); if (is_wp_error($response)) { echo "wp_remote_get ERROR: " . $response->get_error_message() . "\n"; } else { $code = wp_remote_retrieve_response_code($response); $body = wp_remote_retrieve_body($response); echo "HTTP status: $code\n"; echo "Body length: " . strlen($body) . " bytes\n"; echo "First 4 bytes (hex): " . bin2hex(substr($body, 0, 4)) . "\n"; } } else { echo "Avatar value looks like an attachment ID: $avatar_val\n"; $path = get_attached_file((int)$avatar_val); echo "get_attached_file: " . var_export($path, true) . "\n"; echo "file_exists: " . var_export($path && file_exists($path), true) . "\n"; } } else { echo "No avatar value found under either key.\n"; } echo "</pre>";
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Generation time: 0.12 |
proxy
|
phpinfo
|
Settings