Add valid XHTML closing img tags to WordPress galleries

As linked to from the comments on your question, the post_gallery filter should help you here. Unlike a lot of other hooks though, you can’t filter the output that comes through from WordPress; you can only provide your own alternative output. This is slightly annoying, and results in you needing to build the gallery from … Read more

Import post from XML files into custom post type programatically [closed]

After lot of searching about this functionality i have the solutions for this. Please check below example. global $wpdb; if (isset($_POST[‘submit1′])) { //$uri = get_template_directory_uri().’/xmlupload/’; $uri = wp_upload_dir(); $target_dir = $uri; $target_file = $target_dir . basename($_FILES[“fileToUpload”][“name”]); $filename = basename($_FILES[“fileToUpload”][“name”]); $filetypenew = wp_check_filetype($filename); $uploadOk = 1; $FileType = pathinfo($target_file, PATHINFO_EXTENSION); //$FileType = pathinfo($filetype,PATHINFO_EXTENSION); // Check if … Read more

How to assign name the WordPress export.xml file

By default, the filename is defined in /wp-admin/includes/export.php: $sitename = sanitize_key( get_bloginfo( ‘name’ ) ); if ( ! empty( $sitename ) ) { $sitename .= ‘.’; } $date = gmdate( ‘Y-m-d’ ); $wp_filename = $sitename . ‘WordPress.’ . $date . ‘.xml’; And you can filter it: $filename = apply_filters( ‘export_wp_filename’, $wp_filename, $sitename, $date ); So … Read more

wp_get_attachment_url images in wrong order [closed]

Gallerys aren’t implemented the way you’re pulling in images, the images in a gallery might not be attached to the post at all. get_attached_media will give you the images attached to the post by the order of their ID. This means: Images you added to the post, then deleted will be in this array Images … Read more

Rss error in first line of xml : not well-formed (invalid token)

You have additional code active there add this string inside the feed and destroy the XML markup. The hook on this place is rss_tag_pre (see https://github.com/WordPress/WordPress/blob/b3b8942dfcb451eddb5559b63c1043fce5d9449e/wp-includes/feed-rss2.php#L21). Deactivate all plugins, use a default Theme, and then, step by step, activate it again to identify the source for this problem. Alternative search about the wp-content directory for … Read more

How to import nested categories from XML file?

The following code snippet did the trick: <wp:term> <wp:term_id><![CDATA[1]]></wp:term_id> <wp:term_taxonomy><![CDATA[category]]></wp:term_taxonomy> <wp:term_slug><![CDATA[test-category-1]]></wp:term_slug> <wp:term_parent><![CDATA[]]></wp:term_parent> <wp:term_name><![CDATA[Test Category 1]]></wp:term_name> </wp:term> <wp:term> <wp:term_id><![CDATA[2]]></wp:term_id> <wp:term_taxonomy><![CDATA[category]]></wp:term_taxonomy> <wp:term_slug><![CDATA[sub-category-1]]></wp:term_slug> <wp:term_parent><![CDATA[test-category-1]]></wp:term_parent> <wp:term_name><![CDATA[Sub Category 1]]></wp:term_name> </wp:term>

How to import Theme Unit Test on localhost

Your XML file includes the following instructions. Log in to that site as an administrator. Go to Tools: Import in the WordPress admin panel. Install the “WordPress” importer from the list.* Activate & Run Importer. Upload this file using the form provided on that page. You will first be asked to map the authors in … Read more