get_edit_post_link() not working as expected when passed id in plugin

According to the get_edit_post_link() function source this can happen in following conditions:

  • there is no such post;
  • there is no such post type;
  • you don’t have enough permissions to edit the post;
  • _edit_link was changed during post type registration.

The first two are not the case since the ID is available. The fourth is a bad practice: not for general use — core developers recommend you don’t use this when registering your own post type.

In this case, the user doesn’t have enough permissions. According to the OP’s comment under the question, he had been logged out, which is the same sort of thing.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)