wordpress apache permalinks not found — December 7, 2018

wordpress apache permalinks not found

there can be several reasons. For me it was the ‘mod_rewrite’. Permalinks will not work if this mode is disabled in apache because in .htaccess file created by wordpress , there is a check added. No rule will be applied if ‘mod_rewrite’ is disabled.

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

on Ubunutu 16.04 you can enable it like this

sudo a2enmod rewrite
sudo service apache2 restart
ubutnu 16 php enable module pecl http — October 30, 2018

ubutnu 16 php enable module pecl http

Tried so many things in last 2 days and I almost lost hope. But we can install it with a simple command.

sudo apt-get install php-pecl-http

followed so many conversation on stackoverflow about this topic and I was getting more and more errors.

but all thanks to this article on Installion.co.uk

PHP mkdir() show error if directory not created — October 23, 2018
Wordpress publish post with future date — October 17, 2018

Wordpress publish post with future date

WordPress does not provide this functionality by default. There is an option for scheduled posts but you can not publish a post with future date immediately. Tested this code with wordpress 4.9.5.

function tcm_prevent_future_type( $post_data ) {
	if ( $post_data['post_status'] == 'future' && $post_data['post_type'] == 'post' ) {
		$post_data['post_status'] = 'publish';
		remove_action('future_post', '_future_post_hook');
	return $post_data;
add_filter('wp_insert_post_data', 'tcm_prevent_future_type');

You can change {$post_data[‘post_type’] == ‘your_post_type’} post_type to apply this filter to particular post type.

ACF get field default value — October 15, 2018
PHP treats zero (0) as empty . How we can differentiate between zero and empty variable ? — August 8, 2018
Laravel 5.6 assign value to variable in blade template — May 21, 2018