Support » Fixing WordPress » get_sample_permalink is not working, give function not defined error

  • get_sample_permalink() work fine in ajax function but give function not defined error on front end?

    Please let me know how can I resolve this?

    Or there is any way to gey sample permalink for pending post?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The get_sample_permalink() function only works in the admin panel / admin area of WordPress. It works while in AJAX because ajax runs through admin-ajax.php, which technically counts as the admin panel.

    If you _need_ to use that function you’ll have to include the file that the function is in but you’re probably better off finding an alternative solution to whatever the problem is.

    If the post is already created you can just call get_permalink() passing an ID.

    Thanks for help.

    I think it is better to find another way. It’s litle bit confusing as codex page related to this function provide this information.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_sample_permalink is not working, give function not defined error’ is closed to new replies.