I am interpreting the question to mean that you already have Word markup in your post and so you need to clean that up via PHP. If so…
- You can see the code that cleans up Word content here:
http://core.trac.wordpress.org/browser/trunk/src/wp-includes/js/tinymce/plugins/paste/editor_plugin_src.js#L375
That is Javascript. With some work, you could convert that to PHP. - PHP Tidy, if available, will clean that up.
- I believe that HTML Tidy can do it.
strip_tags
will just get rid of the code. (Tested)wp_kses
will get rid of much of it but will take some tweaking to
work well, at least as indicated by my simple test. Maybe with the right arguments it can do what you want.
Related Posts:
- Change padding to text indent in “Increase indent” TinyMCE
- Format the Layout of Images In The Edit Post Textarea?
- Keyboard shortcut for headings on safari
- disable WP automatically inserted line breaks after an image
- Pasting code into pre-formatted text in Visual Editor not working in 3.3.1
- How do I convert a mathematical Microsoft Word document to a WordPress blog post?
- Is there a WordPress equivalent to MediaWiki templates
- Automatically added brs and paragraphs?
- How to add a custom button to the tinyMCE toolbar?
- How to remove_filter that filters iframes in posts? [duplicate]
- Remove whitespace at the end of posts?
- Remove double space after a period
- Code Blocks with WYSIWYG in blog post
- 2nd button row from WP Super Edit or TinyMCE Advanced doesn’t show to 2nd admin
- How to add a custom field after wp post
- Link button is not working while editing a post in Firefox [closed]
- Remove permalink from images when inserting into post
- WordPress’ visual editor messing up my (nested) lists (and other things as well)
- Number format for wp_count_posts()
- Unautop / Sanitize content added to a post through a plugin
- Apostrophe in a possessive appears as an open-single-smart-quote instead of a closed one
- Posting blog entries in screenplay format
- How to get post body look same as my visual editor?
- Can’t give tags rels
- Can’t update WordPress Page if post_content is Empty
- How to determine if a post was last edited in the Visual Editor
- Pasting formatted text from MS-Word
- Right align a youtube video
- All images on one line for each post
- How to add future Posts to the new “Internal Linking” Feature
- Order buttons added to TinyMCE
- ‘QTags.addButton: arg2 distorts the button rather than just shows
- How can I change the date format of the revision list?
- WordPress 5: prevent link from displaying page title instead of URL
- How to allow some visitors to edit inline specific post
- Post formatting bug in WordPress
- Theme does not respect spaces between paragraphs in pages
- When I click edit on a post, all the content disappear. Does anyone know how to fix this?
- Formatting error while publishing theblog from Microsoft Word
- Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]
- Forcing reload of editor-style.css
- Stop WP from creating “Sample Page” and “Hello World!” post
- How to Create Editable Blocks of Text for the Homepage?
- Custom Single Post By Category
- Set Post Title to Read-only and Disable Permalink Slug Editor in Gutenberg
- Get the user type of an author
- Order Posts by Alphabetical for Each Letter
- Restrict access to the Trash folder in Posts
- Post custom permalink results in 404 for archive page
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- How do I get the slug of a custom taxonomy category of a post?
- Hiding posts in a list from specified categories
- Define a name to the posts slug
- Get post id in wordpress action?
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Display post from current category and same tag?
- How to include a post type in the admin/backend?
- Can I use images as anchor tags with
- How to get post bulk edit action trigger and get edited post ids?
- Paginated Posts – Social Media Buttons Share First Page URL
- IP camera jpg stream to post
- Is there a straight-forward way to iterate over all shortcodes in a post?
- Using custom post template
- Adding custom fields to bbpress reply form
- Post id algorithm in WordPress
- Skip in WordPress Post ID’s, can this cause issues?
- Is it possible to disable the image alignment options in the post editor?
- WordPress Comment posting problem
- Pasting code into WordPress post – LFs being eaten
- Remove password protected posts from default RSS feed
- Why posts array is empty?
- How to disable the_excerpt from one post
- Blog post not showing title
- Display the 2nd category name of a custom post type without error if its null?
- How to set a certain Custom Template to a Single Blog Post
- How to Featured content with images in home page?
- why the posts queried from sql is more than those showed on the page?
- Highlighting Current Category in the Archive and Feeds page
- Best Browser for Editing Posts
- Optimal WP Web App Backend for mobile app development
- Change permalinks for posts & for custom post types
- How to customize blog post titles to render a YouTube logo on posts with an embedded video?
- Post page overwrite the custom blog page
- Check if almost 10 year old – working code is up to date
- Query custom post type custom meta key
- WP Ajax returning 0, can’t find action
- Remove pagination if search returns empty
- Page with Category Returning 1
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX
- Use special template for the first post in the loop
- How to modify VisualComposer’s TinyMCE editor only for a specific shortcode
- Expired Post with More Recent Time Stamp?
- Post preview in iframe without saving the post
- Set post beginning date and final date
- How to get only current images of a post
- Using Post ID and Page ID in same function
- How to Include a common category in a custom Category Search
- How do I insert a custom field in a user submitted post?
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- I cannot see the pagination in /wp-admin posts page