WordPress.org

Ready to get started?Download WordPress

Forums

Import is Stripping Tags I Need - How/What to Edit to Filter/Sanitizing (10 posts)

  1. wasana
    Member
    Posted 2 years ago #

    When I import my WXR XML file it appears that wp_insert_post (or another function) is applying filters to strip <?php tags that I need to keep in my content.

    I have searched the various wp-include php files to locate:
    wp_insert_post
    sanitize_post
    wp_strip_all_tags

    but have no clue as to what files to edit -- and what edits to make to keep from stripping the php tags.

    Advice and assistance greatly appreciated. Thanks in advance.

  2. Dr.Misunderstood
    Member
    Posted 2 years ago #

    You should have an XML importer Plug In.
    They will be listed in your Dashboards Plug Ins.
    Click Delete and then select the link labeled:

    "Click to view entire list of files which will be deleted"

    This will list all the associated files.

  3. wasana
    Member
    Posted 2 years ago #

    Dr.Misunderstood, I don't understand what that has to do with my question... the importer is stripping off <?php tags - it used to not do this and was a customization, now apparently built in to latest version unless I am missing something

  4. Dr.Misunderstood
    Member
    Posted 2 years ago #

    The reason being that if you cannot find the files and it is a Plug In you then have a list of all the files. I taught this is what you needed.

    There are other ways to to find out. I have no idea what your technical abilities are. I would right click the up load button and inspect the element. Or search all the PHP files in the WP tree (not just the include folder). I would search for the PHP string pattern replacement functions.
    Such as:

    _replace
    strt
    str_
    preg_
    ereg_

  5. wasana
    Member
    Posted 2 years ago #

    Thanks; I can find the files, such as post.php, but I have no idea what to edit to keep sanitize_post or wp_strip_all_tags or some other function from stripping off the <?php tags in my content.

  6. wasana
    Member
    Posted 2 years ago #

    now I have a related problem that the import is stripping the div tag id= if the div is empty... (I have some sprite images as div id's)

    it imports the div tag, but strips the id

    How can you disable import filtering?

  7. Dr.Misunderstood
    Member
    Posted 2 years ago #

    And you are sure it is not a plug in? That would be the easiest method to add an importer to WP. No PHP scripts in the Plugin folder?

    I just install WP today and it does not have any way to upload any type of document.

    If you can find one of these PHP functions and just put a double slash // in front of it that may clear it up. If you are losing characters it is very likely to be due to a PHP function that matches a pattern and replaces it. These are the common command that are typically used to do that.

    _replace
    strt
    str_
    preg_
    ereg_

  8. wasana
    Member
    Posted 2 years ago #

    thanks Dr.Mis, I enabled define('WP_DEBUG', true); in my wp-config file and I'm seeing so many errors it is looking like I have to just start completely from scratch (this was a new database install of an existing site)

    the double slash is a good tip if after a couple more days of creating this site for the third time... I still have the problem

  9. Dr.Misunderstood
    Member
    Posted 2 years ago #

    It is very difficult to make changes to WP without screwing things up.

    If you have access to phpMyAdmin (on the old and new) you can import the data directly into the new site.

    Just open the database (do not open any tables) Then Export all data and structures to a gzip SQL file and import it to the new site.

    The basic WP package is OK. It's the themes that are horrible.

    I ran some them through a test site GTmetrix.com and the W3C HTML and MobileOK Validators. Nearly all were pathetic. It's the nature of the beast. Trying to make it simple for the masses never goes all that well. WP is OK if you stay away from the dysfunctional themes. Test Test and Test some more. Maybe there is a Web Designer that knows what they are doing. Have not run into one yet.

  10. wasana
    Member
    Posted 2 years ago #

    I have no idea what is going to happen, but in wp-includes/post.php I commented out

    //$postarr = sanitize_post($postarr, 'db');

    and the import is now working... yeah!

    If anyone knows what risks are associated with this I would appreciate hearing back. Thanks Dr.Misunderstood.

Topic Closed

This topic has been closed to new replies.

About this Topic