PHP 8.0.30
Preview: wp-links-opml.php Size: 2.43 KB
/home/certprox/www/wp-links-opml.php

<?php
/**
 * Outputs the OPML XML format for getting the links defined in the link
 * administration. This can be used to export links from one blog over to
 * another. Links aren't exported by the WordPress export, so this file handles
 * that.
 *
 * This file is not added by default to WordPress theme pages when outputting
 * feed links. It will have to be added manually for browsers and users to pick
 * up that this file exists.
 *
 * @package WordPress
 */

require_once __DIR__ . '/wp-load.php';

header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
$link_cat = '';
if ( ! empty( $_GET['link_cat'] ) ) {
	$link_cat = $_GET['link_cat'];
	if ( ! in_array( $link_cat, array( 'all', '0' ), true ) ) {
		$link_cat = absint( urldecode( $link_cat ) );
	}
}

echo '<?xml version="1.0"?' . ">\n";
?>
<opml version="1.0">
	<head>
		<title>
		<?php
			/* translators: %s: Site title. */
			printf( __( 'Links for %s' ), esc_attr( get_bloginfo( 'name', 'display' ) ) );
		?>
		</title>
		<dateCreated><?php echo gmdate( 'D, d M Y H:i:s' ); ?> GMT</dateCreated>
		<?php
		/**
		 * Fires in the OPML header.
		 *
		 * @since 3.0.0
		 */
		do_action( 'opml_head' );
		?>
	</head>
	<body>
<?php
if ( empty( $link_cat ) ) {
	$cats = get_categories(
		array(
			'taxonomy'     => 'link_category',
			'hierarchical' => 0,
		)
	);
} else {
	$cats = get_categories(
		array(
			'taxonomy'     => 'link_category',
			'hierarchical' => 0,
			'include'      => $link_cat,
		)
	);
}

foreach ( (array) $cats as $cat ) :
	/** This filter is documented in wp-includes/bookmark-template.php */
	$catname = apply_filters( 'link_category', $cat->name );

	?>
<outline type="category" title="<?php echo esc_attr( $catname ); ?>">
	<?php
	$bookmarks = get_bookmarks( array( 'category' => $cat->term_id ) );
	foreach ( (array) $bookmarks as $bookmark ) :
		/**
		 * Filters the OPML outline link title text.
		 *
		 * @since 2.2.0
		 *
		 * @param string $title The OPML outline title text.
		 */
		$title = apply_filters( 'link_title', $bookmark->link_name );
		?>
<outline text="<?php echo esc_attr( $title ); ?>" type="link" xmlUrl="<?php echo esc_url( $bookmark->link_rss ); ?>" htmlUrl="<?php echo esc_url( $bookmark->link_url ); ?>" updated="
							<?php
							if ( '0000-00-00 00:00:00' !== $bookmark->link_updated ) {
								echo $bookmark->link_updated;
							}
							?>
" />
		<?php
	endforeach; // $bookmarks
	?>
</outline>
	<?php
endforeach; // $cats
?>
</body>
</opml>

Directory Contents

Dirs: 11 × Files: 36

Name Size Perms Modified Actions
.tmb DIR
- drwxrwxrwx 2022-03-20 16:08:03
Edit Download
- drwxr-xr-x 2024-04-01 02:21:01
Edit Download
@LongLink DIR
- drwxr-xr-x 2025-10-25 02:57:03
Edit Download
bcup DIR
- drwxr-xr-x 2023-07-04 13:23:13
Edit Download
cgi-bin DIR
- drwxr-xr-x 2023-05-29 08:39:47
Edit Download
temp DIR
- drwxrwxrwx 2023-06-11 17:13:28
Edit Download
wp DIR
- drwxr-xr-x 2022-12-03 11:53:44
Edit Download
wp-admin DIR
- drwxr-xr-x 2026-05-21 02:36:30
Edit Download
- drwxr-xr-x 2026-07-29 23:26:34
Edit Download
- drwxr-xr-x 2026-07-17 19:20:46
Edit Download
wpinst DIR
- drwxr-xr-x 2023-05-27 00:31:27
Edit Download
2.24 KB lrw-r--r-- 2026-07-24 02:19:42
Edit Download
1005 B lrw-r--r-- 2025-10-22 08:09:58
Edit Download
2.25 KB lrw-r--r-- 2023-06-04 12:43:37
Edit Download
697 B lrw-r--r-- 2025-10-25 02:39:58
Edit Download
95.08 KB lrwxr-xr-x 2026-01-13 23:28:26
Edit Download
97.46 KB lrwxr-xr-x 2026-05-09 23:28:18
Edit Download
97.46 KB lrwxr-xr-x 2026-05-09 23:30:13
Edit Download
95.08 KB lrwxr-xr-x 2025-10-25 02:59:50
Edit Download
97.46 KB lrwxr-xr-x 2026-05-08 23:27:19
Edit Download
95.08 KB lrwxr-xr-x 2026-01-14 23:27:18
Edit Download
674.12 MB lrw-r--r-- 2023-07-04 13:24:11
Edit Download
18.56 KB lrwxr-xr-x 2026-05-10 23:26:29
Edit Download
1.18 MB lrw-r--r-- 2026-07-29 14:54:20
Edit Download
95.08 KB lrwxr-xr-x 2026-01-15 23:28:29
Edit Download
53 B lrw-r--r-- 2022-01-08 11:53:43
Edit Download
405 B lrw-r--r-- 2020-02-06 06:33:11
Edit Download
19.44 KB lrw-r--r-- 2026-05-21 02:36:23
Edit Download
591 B lrw-r--r-- 2025-10-25 02:39:58
Edit Download
97.56 KB lrw-r--r-- 2026-07-27 06:07:01
Edit Download
7.23 KB lrw-r--r-- 2026-07-17 19:20:46
Edit Download
9.08 KB lrw-r--r-- 2025-09-03 23:20:27
Edit Download
325 B lrw-r--r-- 2023-06-20 12:57:00
Edit Download
7.20 KB lrw-r--r-- 2026-05-21 02:36:31
Edit Download
351 B lrw-r--r-- 2023-05-27 00:31:56
Edit Download
2.27 KB lrw-r--r-- 2023-08-09 04:25:29
Edit Download
3.26 KB lrw-r--r-- 2025-12-03 04:18:59
Edit Download
3.22 KB lrw-r--r-- 2025-10-25 02:54:54
Edit Download
5.49 KB lrw-r--r-- 2024-11-13 19:28:04
Edit Download
2.43 KB lrw-r--r-- 2025-12-03 04:18:53
Edit Download
3.84 KB lrw-r--r-- 2024-07-17 04:19:46
Edit Download
50.63 KB lrw-r--r-- 2026-05-21 02:36:23
Edit Download
8.52 KB lrw-r--r-- 2025-12-03 04:18:53
Edit Download
31.88 KB lrw-r--r-- 2026-05-21 02:36:31
Edit Download
33.81 KB lrw-r--r-- 2026-05-21 02:36:31
Edit Download
5.09 KB lrw-r--r-- 2025-12-03 04:18:53
Edit Download
3.13 KB lrw-r--r-- 2025-04-16 00:51:06
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).