Uploading .docx Files In WordPress

It may be a sign that none of the core WordPress developers much likes or uses Microsoft Office, but the core code hasn’t been updated to recognize the Office 2007 file extensions like .docx, .pptx, or .xlsx. It’s no criticism, wouldn’t have discovered it if a user hadn’t complained, and I stewed a bit before deciding it was a bug.

It’s now ticket #8194 in the WordPress.org Trac. It only affects my MU users now, though, and the same patch works there.

You’ll find a few mentions of doc, ppt, and xls in wp-includes/functions.php (around lines 1613-1615 and 1651-1654 in 2.6.3). Once corrected, those lines should look something like this:

	'document' => array('doc','docx','pages','odt','rtf','pdf'),
	'spreadsheet' => array('xls','xlsx','numbers','ods'),
	'interactive' => array('ppt','pptx','key','odp','swf'),
	'doc|docx' => 'application/msword',
	'pot|pps|ppt|pptx' => 'application/vnd.ms-powerpoint',
	'wri' => 'application/vnd.ms-write',
	'xla|xls|xlsx|xlt|xlw' => 'application/vnd.ms-excel',

Update: Sweet! It’s been accepted and should be in the WP2.7 release.

4 thoughts on “Uploading .docx Files In WordPress

  1. Hmm. In my case, at least, if Word is where I want to do my creation, I’d use Word2007′s “post to blog” feature–and that works beautifully with WordPress…and, as far as I know, didn’t exist in earlier versions. (Actually, I “post as draft,” because it’s easier to go into WP and add categories there, even though you *can* add them in Word.

    I guess it’s a matter of working styles (it would never occur to me to write a post, save it as a .docx, then import it into WP–particularly after I saw how much HTML overhead came into WP the first time I tried it with a .doc file). Certainly good to have both capabilities.

  2. @Walt: you’re right, though this particular bug affects uploading .docx or .pptx files as attachments to a post, much as you might upload a PDF or image. It’s not my thing, but…

  3. How do i upload my ppt(powerpoint) to my personal wordpress?Seems like the ppt already uploaded successfully but didnt show in the page?any idea guys?thanks for advices.

Comments are closed.