In your code, you’re doing this:
$template_file_name = require_once ( get_template_directory() . '/template.docx' );
…but that’s not how require_once
(or require
) works. require_once
will load the file (or throw a warning if the file can’t be included, eg, bad permissions or the file doesn’t exist), but it will not return the filename; it will, instead, load the file and execute any PHP it finds therein.
A .docx
file will not contain executable PHP code (if it does, you’ve got other problems).
In your case, the .docx
file contains an ASCII 20
character, which is DC4
, Device Control 4. This is not expected in a PHP context, so PHP is throwing an error or a warning.
Instead of require_once
, you might be looking for fopen()
or some of PHP’s other filesystem functions.
Related Posts:
- Can a manually uploaded plugin be made to track updates from the WordPress.org plugin directory?
- can’t unzip file
- How to prepare (compress/zip) a plugin to enable updating instead of adding new instance?
- Upload WordPress Plugin from ZIP Broken – Returns Symbols Squares & question marks
- Duplicating wordpress install issue
- ‘Global’ settings page for multisite plugin
- What Are Security Best Practices for WordPress Plugins and Themes? [closed]
- How do I cleanly override a plugin’s CSS with a child theme?
- Add a subitem to Woocommerce section
- PHP code on Visual Composer Plugin
- How are plugins in the WordPress plugin directory ranked?
- How can I log a user out of WordPress before the page loads?
- What does a security risk in a plugin look like?
- Using rewrite rule to access a view of a plugin from home page
- How to make a list of companies’ information and display them to user, using custom post types and a custom taxonomy?
- Thumb rating for wordpress – top user
- update_meta_user difference in i:1 and b:1, how to write b:1
- How to Get Admin Settings for a widget when using the_widget() with custom widget
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- resize only height using wp_get_image_editor
- View the source code of a 3rd party plugin? [closed]
- How to crop image from center using wp_image_editor
- Deactivate plugin upon deactivation of another plugin
- How to find out what blocks are added by a plugin
- Can’t access my WP dashboard: fatal error? [closed]
- allow arabic letters when register new account
- Shortcode in AJAX popup
- Set attached to state
- Use plugin or custom post type for game score functionality
- Converting Attachment to Images?
- How can I see the error generated by plugin activation?
- wordpress reusable content blocks
- How to add a random image to a post from gallery and only show one?
- Need Old Version of plugins
- Is there a filter for get_post_custom()?
- Problem with wordpress version 3.8
- Accessing post’s meta data based on user’s click of a post
- Stuck on image in an Advanced Custom Field loop
- license check in plugin
- With WordPress + Visual Composer, how to restrict a user to change some content in a page?
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Translating long texts with html formatting
- Page Restriction and Redirect for Particular Levels or user
- How to bypass the Easy Digital Downloads checkout process?
- Map Custom Registration Fields to WordPress User Roles
- Making Mathjax dynamic so it renders input without page refresh
- Shrink down register_settings on Settings API
- Front-end only $_POST and $_POST requests handling in WordPress plugin
- WordPress plugin/theme or other wayout to create portable pages?
- How to create user that has permission to create new sites on WordPress with multisite option enabled?
- How does WordPress know when there are plugin updates?
- WordPress Widget – Saving multidimensional arrays into $instance
- date/time-picker and file upload (image) fields for custom fields (e.g. with more fields)
- Reference product SKU on WooCommerce confirmation page [closed]
- Jquery plugin not working on single pages
- Why am I getting a “Call to undefined function curl_init()” when I try to use the Sociable plugin?
- Is there a social members only login plugin for WordPress? [closed]
- How to get menu location in wp_update_nav_menu hook
- rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked
- WordPress Console Application (ability to excecute a custom function via crontab only)
- Private Page View Counter
- Get all the URLs of the pages that uses a specific shortcode
- Why does my jQuery plugin show up as text in WordPress?
- Embed PDF into wordpress
- Extending a theme: build new features as plugin or core modules?
- Why are my constants not available outside my class?
- How to modify the Loop from a plugin (instead of a theme)
- WP Subtitle Plugin Problem
- Switching Code plugins
- help intercepting save_post through plugin
- best way to run a php script away from the template?
- How to save Setting pages data to the database?
- How to Remove all Traces of a WordPress Plugin?
- How to show posts as custom field in specific post type?
- Create Woocommerce account password post-checkout on thank you page
- Prevent WordPress from sending set-cookie http header
- dokan edit functionality
- Automatic chage password of pages after some time
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- How to add post title to custom php?
- How to Disable Auto Executing Script in A Particular Page Only
- wp plugin adds “pagespeed.css” after each css file
- Replace Yoast og:image in single custom post type
- How to change the deafult template in WordPress plugin
- How to save the option’s new values plus old value without overwrite old one
- WordPress Media Uploader : How to add custom button on featured image tab
- Change pricing in Woocommerce based on Category and Product [closed]
- Place content inside the Post Loop
- Re-writing MySQl query for execute faster
- Is there any wordpress function to update a random post every 10 minutes?
- Getting error “The package could not be installed. PCLZIP_ERR_BAD_FORMAT ”
- Editing “Kahi’s Highlight Used Categories” plugin code – highlighting parent and child category in post page
- Making a Plugin work based on URL Location
- Showing author box on post detail page
- What is the correct method for updating post content from a plugin?
- Next and Previous Pagination button not displaying in WordPress
- I Need To Display A Specific Product (Called By Meta Field) On It’s Current WooCommerce Category Page
- query_vars in plugin when using custom permalinks
- How to check record is exist or not in WordPress CRUD Operation with $wpdb
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)